I need a download a file to remote server. But i can't do it with curl in php. The code is:
$ch = curl_init($source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_BUFFERSIZE, 8096);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
var_dump(curl_exec($ch));
print_r(curl_getinfo($ch));
die;
The result is:
string(0) ""
Array
(
[url] => http://example.com/example.zip
[content_type] =>
[http_code] => 204
[header_size] => 213
[request_size] => 118
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 1.180951
[namelookup_time] => 0.012276
[connect_time] => 0.105478
[pretransfer_time] => 0.105523
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 1.18091
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 104.79.246.86
[certinfo] => Array
(
)
[primary_port] => 80
[local_ip] => 192.168.0.14
[local_port] => 46676
)
The file download normaly in browser. what is wrong?. Sorry for my English and thanks for your help