Re: Save page
| From: | Nadim Attari | Date: | Wed, 12 May 2004 06:17:47 +0000 |
| Subject: | Re: Save page | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185952@lists.php.net to get a copy of this message | ||
"Brandon Holtsclaw" <brandon@netsouthern.com> a écrit dans le message de
news:008301c436a6$9e901410$e666a8c0@office.ingramcomputerservices.com...
> try something like
>
> $handle = fopen
> ("http://www.pagetoget.com/thispage.html",
> "rb");
> $contents = "";
> do {
> $data = fread($handle, 1024);
> if (strlen($data) == 0) {
> break;
> }
> $contents .= $data;
> } while(true);
> fclose ($handle);
>
From the PHP manual:
// Another example, let's get a web page into a string. See also
file_get_contents().
$html = implode ('', file ('http://www.example.com/'));
> then you have all text from the .html page in $contents and you can do a
> fwrite on it to a local file, echo it, str_rep etc etc etc
>
> Brandon Holtsclaw
> brandon@netsouthern.com
>
>
> ----- Original Message -----
> From: "Mike Mapsnac" <mikerh9@hotmail.com>
> To: <php-general@lists.php.net>
> Sent: Monday, May 10, 2004 10:37 AM
> Subject: [PHP] Save page
>
>
> > Hello
> >
> > I' m writing php script that will request page and save it locally. The
> page
> > URL will be parameter (example:
> > http://www.pagetoget.com/thispage.html).
> How
> > php can request such page and save it locally on the file?
> >
> > Thanks