i want to download a file with php. The file is generated by a curl call. So how i download the content generated out of the -o Parameter in php (output).
This is my Curl String out of Firefox: curl --header "Host: myurl.org" --header "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:1.0) Gecko/20100101 Firefox/1.0" --header "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8" --header "Accept-Language: de,en-US;q=0.7,en;q=0.3" --header "DNT: 1" --header "Connection: keep-alive" --header "Upgrade-Insecure-Requests: 1" "http://myurl.org/blabla/api_basic/api_wrapper.php?func=reportlist&user=xxx&pwd=xxx" -o "ImportantFile.txt" -L
If i try to download it with the response This is my php:
$fp = fopen($ausgabedatei, "w+");
$ch = curl_init();
// Set query data here with the URL
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYPORT, $proxyport);
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_BUFFERSIZE, (1024*1024*512));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$content = trim(curl_exec($ch));
$details = curl_getinfo($ch);
fclose($fp);
curl_close($ch);
?>
This code only gives back the Response of the call.
"0 successfull" -1
Thanks for your responses.