fopen timing out...

A

Anonymous

Guest
When I try to load a Yahoo Financials stock screen for parsing for my personal stock analyzer I'm coding, fopen only loads part of the page:

Code:
$open = fopen("http://screen.yahoo.com/b?gr=155%2F&peg=/1&b=1&z=gr&db=stocks&vw=1", "r");
$haystack = fread($open, 20000);

fclose($open);
$pos = 0;
echo $haystack;

Is this because it is timing out or something and how do I change the maximum timeout?

Also on a related note, on my other website (but on the same server) sometimes when users upload pictures it looks like it only uploads part of the picture. I assume this is the same problem as above.
 
I'm almost sure the problem is because 20000 bytes aren't enough to read that page. A timeout in this case would be derived from that page's load.

You can try using file_get_contents() like ruturajv said or replacing the 20000 value with filesize($open), or... with a biger value e.g.: 50000
 
Back
Top