Solved ;)
<?php
$host = "yourHost";
$user = "yourUser";
$pass = "yourPass";
$db = "yourDB";
$cursor = "cr_123456";
try
{
$dbh = new PDO("pgsql:host=$host;port=5432;dbname=$db;user=$user;password=$pass");
echo "Connected<p>";
}
catch (Exception $e)
{
echo "Unable to connect: " . $e->getMessage() ."<p>";
}
$dbh->beginTransaction();
$query = "SELECT yourFunction(0::smallint,'2013-08-01 00:00','2013-09-01 00:00',1::smallint,'$cursor')";
$dbh->query($query);
$query = "FETCH ALL IN \"$cursor\"";
echo "begin data<p>";
foreach ($dbh->query($query) as $row)
{
echo "$row[0] $row[1] $row[2] <br>";
}
echo "end data";
?>