Re: http_request
| From: | mbox mbarsalou | Date: | Thu, 30 Sep 2004 06:00:26 +0000 |
| Subject: | Re: http_request | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14692@lists.php.net to get a copy of this message | ||
Exactly what I was looking for....thanks for the leg up!
Mike B.
On Wed, 2004-09-29 at 08:25, Justin Patrin wrote:
> On Wed, 29 Sep 2004 05:28:40 +0000, Mike <barjunk@attglobal.net> wrote:
> >
> > I would like to use http_request to download a file from a website, to
> > the machine that the php script is running on. It is a gzipped file.
> >
> > Is it right to use http_request? It wasn't clear on the website
> > documentation, what I needed to do to make this happen.
> >
> > Thanks for any direction anyone can provide.
> >
>
> require_once('HTTP/Request.php');
> $req = new
> HTTP_Request('http://example.com/file.tgz');
> $req->sendRequest();
> $fd = fopen('/tmp/file.tgz', 'w');
> fwrite($fd, $req->getResponseBody());
> fclose($fd);