Re: file or fopen to fetch a web page???
| From: | Christian Reiniger | Date: | Wed, 24 Jan 2001 11:08:32 +0000 |
| Subject: | Re: file or fopen to fetch a web page??? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-36396@lists.php.net to get a copy of this message | ||
On Wednesday 24 January 2001 01:25, Richard Lynch wrote:
> > I wonder myself, which method is better to fetch a web page:
> >
> > $file = fopen($url, "r");
> > $page = fread($file, 50000);
> >
> > or
> >
> > $file = join('', file($url));
>
> Probably about the same either way...
Perhaps. In an earlier version of PHP I had a problem where the above
code (fopen...) read *more* than the page length. I.e. the page was e.g.
20k big and the fread appended ~5k of junk to it.
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.
- Edsger W. Dijkstra