Re: HTTP_Client and files
| From: | Justin Patrin | Date: | Thu, 11 Nov 2004 18:36:47 +0000 |
| Subject: | Re: HTTP_Client and files | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15455@lists.php.net to get a copy of this message | ||
On Thu, 11 Nov 2004 09:26:00 -0500, Andrew Nagy <asnagy@webitecture.org> wrote:
> Justin Patrin wrote:
>
>
> > On Wed, 10 Nov 2004 16:46:29 -0500, Andrew S. Nagy
> > <asnagy@webitecture.org> wrote:
> >
> >>Is it possible to use HTTP_Client to download files that are posted by a
> >>form? At the moment, I get a blank body value when I try it, unless I
> >>am doing something wrong.
> >>
> >>I would like to automate a process of downloading files via a web form,
> >>similar to fopen where I can get the data back in a string.
> >>
> >
> > If you're trying to download a remote file, yes HTTP_Client (and
> > HTTP_Request) can do this. Could you give more info?
>
> Yes, I want to be able to download a remote file that is sent via a web
> form with HTTP_Client.
>
> The form upon submit sends a file to the client for download, I would
> like to be able to download this file using HTTP_Client. When I tried
> it, I just got the body field empty and no data.
>
> Can you give me an example as how to do this?
>
Post the form using HTTP_Client and read the file back. If it's not
working, check the headers returned and see if they look right. Sorry,
I can't really help you with more unless I know some specifics/see
some code. I have multiple scripts which use HTTP_Client to download
files in this manner and they work fine. It often takes looking into
the HTML of the form and watching the headers of a normal web browser
transaction to get it done, though.
Perhaps there's a redirect? Usually when the body's empty, there's
something in the headers. Try turning on the auto-redirect
functionality of HTTP_Client/Request.
--
Justin Patrin