I am trying to download a zip file from the server that I host and store it on another server using PHP and cURL. My PHP looks like this:
set_time_limit( 0 );
$ci = curl_init();
curl_setopt_array( $ci, array(
CURLOPT_FILE => '/directory/images.zip',
CURLOPT_TIMEOUT => 3600,
CURLOPT_URL => 'http://example.com/images/images.zip'
) );
curl_exec( $ci );
curl_close( $ci );
Whenever I run this, I get the following error on the line CURLOPT_URL:
Warning: curl_setopt_array (): the supplied argument is not a valid File-Handle resource in ...
If I am in the file location directly in my browser, it is downloaded. Do I need to pass some header information so that he knows that this is a zip file? Is there any way to debug this?
source
share