I'm using fopen() to parse a web-page. No big deal, I do it all the time. Problem is, it's not working for ONE page. Using this code to simply open the file and spit it back out ot the browser:
<?
$myURL = "http://cnn.com";
//$myURL = "http://myplanetside.station.sony.com/character.jsp?charId=278429&worldId=15";
$fh = fopen($myURL,"rtb") or die($php_errormsg);
do {
$data = fgets($fh, 4096);
if (strlen($data) == 0) {
break;
}
echo $data;
} while(true);
?>
With the CNN URL, it displays the whole page fine. Use the planetside URL and I get the first 27 lines only.
I've used the while(!feof()) business, I've used fgets and fread, no matter what I do (I've changed the "rtb" in my fopen call to every possible combination... I've done EVERYHTING) I only pull the first 27 lines. I view the source in a browser, and nothing looks "special" about line 27 or 28... just normal stuff.
Other folks have run this eact script and gotten it to run fnie on both URLs on older 4.1.x versions of PHP. Could there be some odd invisible characters in the file that forcing PHP to end the open early?
/me bashes head into desk.