Jump to content

cURL question


jl5501

Recommended Posts

Ok, I have a customer login area where I am authorised to login, and retrieve a file. You navigate to a page with a download link, and then the link fires a cgi script which generates a zip file, and dutifully causes the browser to prompt for download.

 

So, I wish to download this file directly to a server, using cURL. All goes well as far as logging in, and navigating to the page with the download link, then when triggering the download link, I get no error, but just a formatted html page saying 'no records to download'.

 

The file is 113MB when the request is a normal link click.

 

So the question is, what am I not doing when trying to get this file with cURL.

 

The php code after successfully navigating to the download page is

 

$fp = fopen("savedfile.txt","w");
curl_setopt($ch, CURLOPT_URL, 'https://www.sitename.com/rtl_cgi/send-rtl-files.cgi?p_fileid=103');
curl_setopt($ch, CURLOPT_REFERER, 'https://www.sitename.com/rtl_supplier/rtl_ldc_file_transfers.ldc_files_out');
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$output = curl_exec($ch);
echo $output;
curl_close($ch);
fclose($fp);

 

Any pointers would be gratefully accepted.

Link to comment
https://forums.phpfreaks.com/topic/194758-curl-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.