Re: How to download a file (with browser) using fsockopen() ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wow, did you have to post this 6 times barney??

szalinski wrote:
Hi

I have been working on this download script for quite a while, and I just
can't find how to download a remote file via a user's browser using
fsockopen.

Basically I am wondering if anyone can just give me a simple working
example on how to use fsockopen() to fetch a file on a remote server, and
then pop up a save dialog box in my browser. For example, let's say I want
to download this file from here:

http://remotedomain.com/file.zip

Instead of putting this directly into my browser and then being prompted
to save it to my pc, how can i use fsockopen() to fetch the file, and get
the same prompt on my browser? E.g. I want to be able to do

http://localhost/index.php?url=http://remotedomain.com/file.zip

I know that this does not seem the most obvious and easy way to do it, but
i simply cannot get a file to download myself using fsockopen. I
specifically want this function, as I need to POST headers to the server
and I haven't as yet been able to download a file using it, without it
being corrupt, or the connection hanging. I just can't figure it out, and
I'm getting a bit tired with it!
I don't need a whole hand-made script, I just need the part where
fsockopen will download this file. Perhaps a working function that would
do it. Please try not to use classes or objects because I haven't quite
figured out object-oriented programming yet!!

Also, I would like if you can do it via HTTP 1.0 because I know HTTP 1.1
is tricky, and might require a chunk decoder, and i don't see the need for
it, unless someone is able to provide a working chunked data decoder.

Thanks to anyone who can help. :)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux