API connection issues

489 views
Skip to first unread message

Alex Fischer

unread,
Jan 19, 2018, 3:32:23 PM1/19/18
to AdWords API Forum
Hi:

This is my first post here, and I'll try to adhere to the guidelines but please forgive if I miss something.

We have developed a year ago PHP code that connects to the AdWords API and downloads daily some kinds of reports (campaign, adgroup, keyword and ad) for the accounts of our customers. This has been working flawlessly until today where we have been getting the error which I'll post below. Before posting we updated the API to the latest v201710 but the error continues. We have tried a couple of times and it always returns but on different accounts. Sometimes an account works and on the next try it fails. This is the error we get:


[2018-01-19 12:04:43] AW_REPORT_DOWNLOADER.WARNING: clientCustomerId=31xxxxxxxx1 Marnitrack Adwords (AwApi-PHP, googleads-php-lib/32.1.0, PHP/5.6.30-0+deb8u1, GuzzleHttp/6.2.1, curl/7.38.0, ReportDownloader/string) "POST /api/adwords/reportdownload/v201710 HTTP/1.1" Status: NULL   

[2018-01-19 12:04:43] AW_REPORT_DOWNLOADER.NOTICE: Request:

POST /api/adwords/reportdownload/v201710 HTTP/1.1

Content-Type: application/x-www-form-urlencoded

Host: adwords.google.com

Authorization: REDACTED

developerToken: REDACTED

clientCustomerId: 3173637751

User-Agent: Marnitrack Adwords (AwApi-PHP, googleads-php-lib/32.1.0, PHP/5.6.30-0+deb8u1, GuzzleHttp/6.2.1, curl/7.38.0, ReportDownloader/string)

skipReportHeader: true

skipColumnHeader: true

skipReportSummary: true

useRawEnumValues: false


__rdxml=<?xml version="1.0"?>

<reportDefinition><selector><fields>AccountDescriptiveName</fields><fields>Date</fields><fields>AdNetworkType1</fields><fields>CampaignName</fields><fields>ExternalCustomerId</fields><fields>CampaignStatus</fields><fields>AccountCurrencyCode</fields><fields>Impressions</fields><fields>Clicks</fields><fields>Ctr</fields><fields>AverageCpc</fields><fields>SearchImpressionShare</fields><fields>Cost</fields><fields>AveragePosition</fields><fields>Conversions</fields></selector><reportName>-</reportName><reportType>CAMPAIGN_PERFORMANCE_REPORT</reportType><dateRangeType>YESTERDAY</dateRangeType><downloadFormat>CSV</downloadFormat></reportDefinition>



Response:

REDACTED REPORT DATA

--------

Error:

Error creating resource: [message] fopen(https://adwords.google.com/api/adwords/reportdownload/v201710): failed to open stream: Connection timed out

[file] /home/users/marnico/marnico/web26/web/desarrollo/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php

[line] 324

  

PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Error creating resource: [message] fopen(https://adwords.google.com/api/adwords/reportdownload/v201710): failed to open stream: Connection timed out

[file] /home/users/marnico/marnico/web26/web/desarrollo/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php

[line] 324' in /home/users/marnico/marnico/web26/web/desarrollo/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php:252

Stack trace:

#0 /home/users/marnico/marnico/web26/web/desarrollo/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php(336): GuzzleHttp\Handler\StreamHandler->createResource(Object(Closure))

#1 /home/users/marnico/marnico/web26/web/desarrollo/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php(52): GuzzleHttp\Handler\StreamHandler->createStream(Object(GuzzleHttp\Psr7\Request), Array)

#2 /home/users/marnico/marnico/web26/web/desarrollo/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(52): GuzzleHttp\Handler\StreamHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)

#3 /home/us in /home/users/marnico/marnico/web26/web/desarrollo/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 52



Can anybody explain what is going on?


Regards and thank you in advance.


Alex Fischer

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jan 19, 2018, 4:45:33 PM1/19/18
to adwor...@googlegroups.com
Hi Alex, 

Welcome to the forum!

We had replied to this question on the private thread that you had created earlier today. However, for the benefit of everyone else on this forum, let me share it here as well. We can continue the discussion on this thread to avoid duplicates. I ran a test report with the same report definition against your account and it worked fine. Size of the report doesn't seem to be the issue here. Could you try to increase the timeout as given in this guide and see if that helps? Let me know how it goes.

Thanks,
Sreelakshmi, AdWords API Team
Reply all
Reply to author
Forward
0 new messages