Getting empty string error when trying to get campaigns

1,303 views
Skip to first unread message

jaison....@gmail.com

unread,
Mar 21, 2014, 3:19:57 AM3/21/14
to adwor...@googlegroups.com
Hi,

I'm trying to fetch campaigns in a client account but I get the following error:

Failed to load response into DOM: DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input in adwords\src\Google\Api\Ads\Common\Lib\AdsSoapClient.php on line 248


In the request_info.log I see the following:


[Mar 21 2014 07:53:15.000000 - ERROR] email=XXX-XXX-XXX effectiveUser=XXXXXXXXX service=CampaignService method=get operators={} responseTime=null requestId=null operations=null units=null server=adwords.google.com isFault=true faultMessage=Error Fetching http body, No Content-Length, connection closed or chunked data



Please not that I'm using the PHP adwords client library.
Does anyone know what is causing this? The code was working as expected before, and I have made no changes.

sho...@perfectstormmedia.com

unread,
Mar 21, 2014, 3:37:18 AM3/21/14
to adwor...@googlegroups.com
Hi Adwords API team,

Since today morning, even we are  getting the error "Error Fetching http body, No Content-Length, connection closed or chunked data" while fetching the data from Adwords API v201309 using the PHP client library. Can somebody please let us know how this can be fixed as it is affecting our site alot?

shobha.p...@gmail.com

unread,
Mar 21, 2014, 3:50:56 AM3/21/14
to adwor...@googlegroups.com

 Hi Adwords API team,

We are facing the same issue. We are using Adwords Google API v201309  with PHP Client Library. We are getting the error Error Fetching http body, No Content-Length, connection closed or chunked data while making calls to API.

Can you please let us know if there has been some change at API end which is causing it? And when would it be fixed.

On Friday, March 21, 2014 12:49:57 PM UTC+5:30, jaison....@gmail.com wrote:

Chirag

unread,
Mar 21, 2014, 5:46:15 AM3/21/14
to adwor...@googlegroups.com
Hello All,

I am also facing same error.

[Mar 21 2014 15:13:28.000000 - ERROR] email= effectiveUser= service=AdGroupAdService method=mutate operators={ADD: 1} responseTime=null requestId=null operations=null units=null server=adwords.google.com isFault=true faultMessage=Error Fetching http body, No Content-Length, connection closed or chunked data

Thanks,
Chirag

Filip Holmberg

unread,
Mar 21, 2014, 5:51:15 AM3/21/14
to adwor...@googlegroups.com
Same here.  

techn...@usine23.com

unread,
Mar 21, 2014, 6:10:09 AM3/21/14
to adwor...@googlegroups.com
Same here since this morning...

Note that i'm using the v201309 version of the PHP API

u_api_user

unread,
Mar 21, 2014, 6:34:00 AM3/21/14
to adwor...@googlegroups.com
We have the same problem. It is a critical one cause it concerns allmost all soap requests we execute.

thx in advance for your help

Ayoub Khobalatte

unread,
Mar 21, 2014, 7:02:34 AM3/21/14
to adwor...@googlegroups.com
We are also having this issue. It's quite a critical one.
We noticed that this issue happens when using PHP 5.3. All request work fine when excuted with PHP 5.4. Maybe the user agent plays a role?

Pierre Grimaud

unread,
Mar 21, 2014, 7:07:38 AM3/21/14
to adwor...@googlegroups.com
Same with PHP 5.3.3-7+squeeze14.

MWA

unread,
Mar 21, 2014, 7:16:55 AM3/21/14
to adwor...@googlegroups.com
I am also facing same problem. Does anybody know how to fix this?

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
                        )

                )

Filip Holmberg

unread,
Mar 21, 2014, 7:39:25 AM3/21/14
to adwor...@googlegroups.com
It indeed seems to be php version related. We are running 5.3.10 on our production server and locally the API works when running 5.4.10. Even 5.3.20 seemed to work.

Would be nice to know what kind of changes google have made that causes this problem. Docs says that 5.2.x would be enough. 

Thanks alot Ayoub for leading us in the right direction.

- Filip

Danial Klimkin

unread,
Mar 21, 2014, 8:40:50 AM3/21/14
to adwor...@googlegroups.com
Hello All,


We've identified this issue and investigating now. We'll update this thread once we have more details.


-Danial, AdWords API Team.

Pierre Grimaud

unread,
Mar 21, 2014, 11:18:21 AM3/21/14
to adwor...@googlegroups.com
Vincent Tsao proposes a temporary fix : 

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

Abdelali AHBIB

unread,
Mar 21, 2014, 12:13:16 PM3/21/14
to adwor...@googlegroups.com
Worked for me yesterday, but today when I run the same script with the same configuration in the same server I had the message : 
An error has occurred: Error Fetching http body, No Content-Length, connection closed or chunked data

jody stein

unread,
Mar 21, 2014, 12:15:03 PM3/21/14
to adwor...@googlegroups.com
Is there any update on this situation?

Stephen Yeargin

unread,
Mar 21, 2014, 12:20:12 PM3/21/14
to adwor...@googlegroups.com
Hi Danial,

Is there a status board for the AdWords API for service interruptions? I need to be able to keep my boss/staff apprised of issues that aren't directly related to our code.

- Stephen

Steve B

unread,
Mar 21, 2014, 1:05:15 PM3/21/14
to adwor...@googlegroups.com
Problem is still happening to me here, as well…   FYI, we're using PHP 5.2.4-2ubuntu5.17.
-->Steve Bennett

Rob Rudnicki

unread,
Mar 21, 2014, 2:24:01 PM3/21/14
to adwor...@googlegroups.com
for those looking at this thread for updates. The issues seems to have been resolved.  I had the issue earlier but no longer.
Message has been deleted

Ray Tsang (AdWords API Team)

unread,
Mar 21, 2014, 6:33:58 PM3/21/14
to adwor...@googlegroups.com
Hi All,

We’ve identified the cause for this issue.  The fix has been deployed and your requests should continue to work now.

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,


Ray Tsang - AdWords API Advisor

Ray Tsang (AdWords API Team)

unread,
Apr 3, 2014, 10:20:49 AM4/3/14
to adwor...@googlegroups.com

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.


PHP 5.2 users take note: We are unable to force HTTP 1.0 protocol in PHP 5.2.x.  PHP 5.2 has been unsupported for more than 3 years.  We recommend you upgrade to a current PHP version as soon as possible to avoid future interruptions.

Thanks,

Ray Tsang - AdWords API Advisor

Willy D

unread,
Mar 14, 2016, 8:28:53 AM3/14/16
to AdWords API Forum
Hi Ray,

This error just happened to me last Saturday. It was working fine before and no code change or server configuration change.

I am using PHP5.2.17, and unable to upgrade it to later version. Is there solution or temporary solution for this?

Since it was working fine before using PHP5.2.17 as well, not sure what should I do.

Please kindly help since this affecting all request to the API.

Thanks a lot in advance,
Willy

Anthony Madrigal

unread,
Jun 21, 2016, 4:53:58 PM6/21/16
to AdWords API Forum
Hi Willy,

If you are still having issues with this, please file an issue on our Github PHP page.

Regards,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages