When I browse to a page with Firefox and click a download link, the following headers are shown when I inspect the request in network inspector:
Connection: keep-alive Content-Disposition: attachment; filename="example_file.mp3" Content-Length: 35181829 Content-Transfer-Encoding: binary Content-Type: audio/mpeg Date: Fri, 19 Aug 2016 18:19:02 GMT Keep-Alive: timeout=60 Server: nginx X-Powered-By: PHP/5.4.45
However, when I use cURL to visit the same address, I get this:
Connection: keep-alive Content-Length: 1918 Content-Type: text/html; charset=UTF-8 Date: Fri, 19 Aug 2016 20:46:23 GMT Keep-Alive: timeout=60 Server: nginx X-Powered-By: PHP/5.4.45
How can I form a request with cURL that gives me the same response as Firefox?
Example:
$headers = array('HeaderName:HeaderValue','HeaderName2:HeaderValue2');
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
That should produce the exact same HTTP-Response headers.