How do you set the content type of an HTTP Request?
I’ve tried this:
$headers['Accept'] = 'application/xml';
$headers['Content-Type'] = 'application/xml';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
And this is the result:
HTTP/1.1 200 OK
Content-Encoding: gzip
Content-Type: text/html;charset=UTF-8
Date: Thu, 22 Mar 2012 14:04:36 GMT
but no luck so far…
What do I have to do to get an Content-Type: application/xml in my HTTP response?
I believe the headers must be a plain array whose elements are full key:value headers, not an associative array:
This is specified in the
curl_setopt()documentation.