> Programming Languages > PHP
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on PHP



PHP - "Re: Fread and multiple packets" in Programming Languages


Old 06-21-2004   #1
..cha.. ..st..
 
Default Re: Fread and multiple packets

Rene van Lieshout wrote:

> Hello,
>
> I'm trying to read from a webpage using fread. The webpage contains a
> list of data I need to parse into my administration.
>
> I get some data after sending a GET request. The problem is that this
> data is incomplete.
>
> I used a packet sniffer to find out what my normal browser did and
> found that the result is sent to me in multiple packets.
>
> The question: how can I receive the other packets?
>
> The code I use for receiving the data:
>
> Code:
>
> ////$data="";

$data = '';
> while (!feof($fp)) {
> $data .= fread($fp, 4096);

^^^
> }



works for me:

Source code:

<?php
$handle = fopen("http://www.[pick-a-site].com/", "rb");

$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($handle);
echo $contents;
// now put parsing stuff here...
?>
 

Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0