Re: Downloading webpages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Morten,
    the reason for this is outlined here: http://us2.php.net/fread.
Network streams are only made available to fread() one packet at a
time. Doing a while loop is the recommended way of getting around
this.


On Tue, 12 Oct 2004 23:44:43 +0100, Morten Pedersen
<esc@xxxxxxxxxxxxxxxxxx> wrote:
> 
> I'm attempting to download a webpage (http://finance.yahoo.com/q?s=erts), using the following code
> 
>    $fp=fopen($quote_url,'rb');
>    $contents=fread($fp,500000);
>    fclose($fp);
> 
> but it only downloads part of the webpage (1460 bytes to be exact). Putting the fread inside a while loop and reading until 0 bytes read eventually gets the entire page. Anyone know the reason for this, and how to fix it?
> 
> 


-- 
William Cox

email: mydimension@xxxxxxxxx
blog: http://my-dimension.com

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux