SoapFault Object
(
[message:protected] => Error Fetching http body, No Content-Length, connection closed or chunked data
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /var/www/adwords_api/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php
[line:protected] => 194
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /var/www/adwords_api/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php
[line] => 194
[function] => __doRequest
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => <?xml version="1.0" encoding="UTF-8"?>
[1] => https://adwords.google.com/api/adwords/cm/v201306/CampaignService
[2] =>
[3] => 1
)
)
The clarify the issue, it is with some versions of PHP not handling decoding HTTP 1.1 responses when the response uses the chunked data mechanism. The fix for now is to do the following:
In the file Google/Api/Ads/Common/Lib/SoapClientFactory.php,
right before line 147 where the line says "$options['stream_context'] = stream_context_create($contextOptions);"
add the following line of code:
$contextOptions['http']['protocol_version'] = 1.0;
This forces the client library to make requests with HTTP 1.0, which is not ideal. What you should do if you can is update your version of PHP to a version > 5.3 as this issue seems to occur in some versions of 5.3.x as well. This is a PHP language bug.
source : github
Longer Answer:
There was a recent server change to utilize the HTTP 1.1 chunked transfer encoding. This change affected some of the PHP platform versions that cannot properly handle HTTP 1.1 protocol with respect to chunked transfer.
This inadvertently affects any applications/libraries using those older PHP versions, which includes the Ads PHP client library as well.
We’ve removed chunked transfer encoding from the server side. Your requests should continue to work now. Your previous requests that resulted “Error Fetching http body, No Content-Length, connection closed or chunked data” errors were processed by the AdWords API servers, but the SOAP response could not be decoded due to the aforementioned issue related to the some of the older PHP versions.
As far as we know, PHP 5.4 is the only version that’s completely unaffected. All PHP 5.2 users are recommended to upgrade since PHP 5.2 has been end-of-life for more than 3 years.
We are also working on a client library update to force HTTP 1.0 protocol if you are using an affected PHP version. Please lookout for an update on this thread when the library is ready.
Cheers,
Hi All,
Because PHP 5.3.x does not handle HTTP 1.1 chunked encoding properly, we've updated the PHP Google Ads client library to use HTTP 1.0 for PHP 5.3.x.
You can download the updated client library from GitHub.