Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- curl and download
September 14, 2006, 2:27 pm
rate this thread
have a little question:
If I post to a certain url , and that page returns a file for download.
(it doesn't display anything)
How can accept the download, and read the contents...?
My code :
$postarr["user"] = "user";
$postarr["pw"] = "pw";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.website.com/page.asp ");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postarr);
$data = curl_exec($ch);
Re: curl and download
Does this not work?
Have you tried turning CURLOPT_VERBOSE on to work out why?
At a wild guess do you need CURLOPT_FOLLOWLOCATION?
Andy Hassall :: firstname.lastname@example.org :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
- » preg_replace backreference value as a key to array
- — Previous thread in » PHP Scripting Forum