Saturday, June 03, 2006

PHP: feof - and infinite loop

you can avoid the infinite loop and filling the error logs by an simple if statement in php Here is the example

$handle = fopen("http://xml.weather.yahoo.com/forecastrss?p=AYXX0008&u=f", "r");

$xml = "";

if ($handle) {

while (!feof($handle))

{

$xml .= fread($handle, 128);

}

fclose($handle);

}

Read more at ro.php.net/manual/en/fu...

No comments: