411. Length error at google

Please help i am need to fix my code, and don’t know how… Google get me 411 error, but when i am send content length in header…
[php]$authToken = getAuthorizationToken();
$xml_data = ’<?XML version="1.0"?>






';
$length = strlen($xml_data);
$ch = curl_init(“http://www.google.com/cse/api/default/promotions/pe0dnd27zuc”);
$header = array();
$header[] = ‘Authorization: GoogleLogin auth=’ . $authToken;
$header[] = ‘Content-Type: text/xml’;
$header[] = 'Content-Length: ’ . $length;
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
$result = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);[/php]

How fix that? When i am delete
[php]$header[] = 'Content-Length: ’ . $length;[/php]
It’s not help…

Hmmm, you cross-posted to other sites. On one of them, there was more than one answer given.

Here is your message and their replies:
http://stackoverflow.com/questions/9476253/411-error-from-google-content-length

Sponsor our Newsletter | Privacy Policy | Terms of Service