The following cURL configuration works fine on my local machine using cURL 7.30.0:
$curl = curl_init();
curl_setopt_array($curl, array(
// Just showing the noteworthy options here.
CURLOPT_HTTPHEADER => array("Content-Type: application/x-www-form-urlencoded")
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0,
CURLOPT_COOKIE => "foo=bar",
));
$response = curl_exec($curl);
curl_close($curl);
Excerpt of the debugging output:
> GET / HTTP/1.0
Host: example.com
Accept: */*
Cookie: foo=bar
Content-Type: application/x-www-form-urlencoded
Now I run the same code on a shared hosting environment with cURL 7.19.7 and get:
> GET / HTTP/1.1
Host: example.com
Accept: */*
Content-Type: application/x-www-form-urlencoded
Basically cURL is working 99% fine, but ignores the forced HTTP version and cookie string. Is the hosting company running a configuration that blocks these features? Is the cURL version they are running too old? What's going on here?