Failed to connect... Network is unreachable

1,058 views
Skip to first unread message

Todd Norton

unread,
Sep 19, 2016, 10:38:39 PM9/19/16
to AdWords API Forum
An error has occurred: Failed to connect to 2607:f8b0:4005:808::200d: Network is unreachable

Seen a few questions on this.  It appears as though its through ipv6.

I run the AdWords API and it successfully works.  Then I run it again and I get that error message over and over.  

So I tried it on my mobile phone on a different network.  Same result, it worked once, then I refreshed and keep getting error.

I am utilizing Bluehost as my server and when checking firewall settings for Port 443 it is whitelisted: http://firewalltester.bluehost.com/cgi-bin/firewall

Is is the full VAR_DUMP in PHP:

OAuth2Exception::__set_state(array(
   'message' => 'Failed to connect to 2607:f8b0:4005:804::200d: Network is unreachable',
   'string' => '',
   'code' => 200,
   'file' => '/home4/xxxx/public_html/burkett/googleads/src/Google/Api/Ads/Common/Util/SimpleOAuth2Handler.php',
   'line' => 116,
   'trace' => 
  array (
    0 => 
    array (
      'file' => '/home4/xxxx/public_html/burkett/googleads/src/Google/Api/Ads/Common/Util/SimpleOAuth2Handler.php',
      'line' => 96,
      'function' => 'MakeRequest',
      'class' => 'SimpleOAuth2Handler',
      'type' => '->',
      'args' => 
      array (
        0 => 'https://accounts.google.com/o/oauth2/token',
        1 => 
        array (
          'refresh_token' => '1/xxxx',
'client_id' => 'xxxx-xxxx.apps.googleusercontent.com',
'client_secret' => 'xxxx',
'grant_type' => 'refresh_token', ), ), ), 1 => array ( 'file' => '/home4/xxxx/public_html/burkett/googleads/src/Google/Api/Ads/Common/Util/OAuth2Handler.php',
'line' => 116, 'function' => 'RefreshAccessToken', 'class' => 'SimpleOAuth2Handler', 'type' => '->', 'args' => array ( 0 => array ( 'client_id' => 'xxxx-xxxx.apps.googleusercontent.com',
'client_secret' => 'xxxx',
'refresh_token' => '1/xxxx',
), ), ), 2 => array ( 'file' => '/home4/xxxx/public_html/burkett/googleads/src/Google/Api/Ads/AdWords/Util/v201607/ReportUtilsDelegate.php',
'line' => 276, 'function' => 'GetOrRefreshAccessToken', 'class' => 'OAuth2Handler', 'type' => '->', 'args' => array ( 0 => array ( 'client_id' => 'xxxx-xxxx.apps.googleusercontent.com',
'client_secret' => 'xxxx',
'refresh_token' => '1/xxxx',
), ), ), 3 => array ( 'file' => '/home4/xxxx/public_html/burkett/googleads/src/Google/Api/Ads/AdWords/Util/v201607/ReportUtilsDelegate.php',
'line' => 86, 'function' => 'GetHeaders', 'class' => 'ReportUtilsDelegate', 'type' => '::', 'args' => array ( 0 => AdWordsUser::__set_state(array( 'libVersion' => '12.0.0', 'libName' => 'AwApi-PHP', 'userAgent' => NULL, 'scopes' => array ( 0 => 'https://www.googleapis.com/auth/adwords', ), 'requestHeaderElements' => array ( 'userAgent' => ' (AwApi-PHP/12.0.0, Common-PHP/12.0.0, PHP/5.6.24)', 'clientCustomerId' => 'xxxxxxxxxxxx',
            'developerToken' => 'xxxx-xxxx',
), 'defaultServer' => 'https://adwords.google.com', 'defaultVersion' => 'v201607', 'logsDirectory' => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting',
'soapCompression' => true, 'soapCompressionLevel' => '1', 'wsdlCache' => 0, 'forceHttpVersion' => NULL, 'forceAddXsiTypes' => false, 'authServer' => 'https://accounts.google.com', 'oauth2Info' => array ( 'client_id' => 'xxxx-xxxx.apps.googleusercontent.com',
'client_secret' => 'xxxx',
'refresh_token' => '1/xxxx',
), 'oauth2Handler' => SimpleOAuth2Handler::__set_state(array( 'curlUtils' => CurlUtils::__set_state(array( )), 'server' => 'https://accounts.google.com', 'scopes' => array ( 0 => 'https://www.googleapis.com/auth/adwords', ), )), 'isIncludeUtilitiesInUserAgent' => 'true', 'libVersion' => '12.0.0', 'libName' => 'Common-PHP', )), 1 => 'https://adwords.google.com/api/adwords/reportdownload/v201607', 2 => array ( 'version' => 'v201607', ), ), ), 4 => array ( 'file' => '/home4/xxxx/public_html/burkett/googleads/src/Google/Api/Ads/AdWords/Util/v201607/ReportUtils.php',
'line' => 107, 'function' => 'DownloadReportWithAwql', 'class' => 'ReportUtilsDelegate', 'type' => '::', 'args' => array ( 0 => 'SELECT OfferId, Brand, Cost, Clicks, CustomAttribute4, Ctr, AverageCpc, Conversions, CampaignName, AdGroupName, Impressions FROM CRITERIA_PERFORMANCE_REPORT WHERE Status IN [ENABLED, PAUSED] DURING 20160912,20160918', 1 => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting/report.csv',
2 => AdWordsUser::__set_state(array( 'libVersion' => '12.0.0', 'libName' => 'AwApi-PHP', 'userAgent' => NULL, 'scopes' => array ( 0 => 'https://www.googleapis.com/auth/adwords', ), 'requestHeaderElements' => array ( 'userAgent' => ' (AwApi-PHP/12.0.0, Common-PHP/12.0.0, PHP/5.6.24)', 'clientCustomerId' => '934-455-0108', 'developerToken' => 'xxxx-xxxx',
), 'defaultServer' => 'https://adwords.google.com', 'defaultVersion' => 'v201607', 'logsDirectory' => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting',
'soapCompression' => true, 'soapCompressionLevel' => '1', 'wsdlCache' => 0, 'forceHttpVersion' => NULL, 'forceAddXsiTypes' => false, 'authServer' => 'https://accounts.google.com', 'oauth2Info' => array ( 'client_id' => 'xxxx-xxxx.apps.googleusercontent.com',
'client_secret' => 'xxxx',
'refresh_token' => '1/xxxx',
), 'oauth2Handler' => SimpleOAuth2Handler::__set_state(array( 'curlUtils' => CurlUtils::__set_state(array( )), 'server' => 'https://accounts.google.com', 'scopes' => array ( 0 => 'https://www.googleapis.com/auth/adwords', ), )), 'isIncludeUtilitiesInUserAgent' => 'true', 'libVersion' => '12.0.0', 'libName' => 'Common-PHP', )), 3 => 'CSV', 4 => array ( 'version' => 'v201607', ), ), ), 5 => array ( 'file' => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting/DownloadCriteriaReportWithAwql.php',
'line' => 82, 'function' => 'DownloadReportWithAwql', 'class' => 'ReportUtils', 'type' => '->', 'args' => array ( 0 => 'SELECT OfferId, Brand, Cost, Clicks, CustomAttribute4, Ctr, AverageCpc, Conversions, CampaignName, AdGroupName, Impressions FROM CRITERIA_PERFORMANCE_REPORT WHERE Status IN [ENABLED, PAUSED] DURING 20160912,20160918', 1 => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting/report.csv',
2 => AdWordsUser::__set_state(array( 'libVersion' => '12.0.0', 'libName' => 'AwApi-PHP', 'userAgent' => NULL, 'scopes' => array ( 0 => 'https://www.googleapis.com/auth/adwords', ), 'requestHeaderElements' => array ( 'userAgent' => ' (AwApi-PHP/12.0.0, Common-PHP/12.0.0, PHP/5.6.24)', 'clientCustomerId' => 'xxxxxxxxxxxx',
            'developerToken' => 'xxxx-xxxx',
), 'defaultServer' => 'https://adwords.google.com', 'defaultVersion' => 'v201607', 'logsDirectory' => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting',
'soapCompression' => true, 'soapCompressionLevel' => '1', 'wsdlCache' => 0, 'forceHttpVersion' => NULL, 'forceAddXsiTypes' => false, 'authServer' => 'https://accounts.google.com', 'oauth2Info' => array ( 'client_id' => 'xxxx-xxxx.apps.googleusercontent.com',
'client_secret' => 'xxxx',
'refresh_token' => '1/xxxx',
), 'oauth2Handler' => SimpleOAuth2Handler::__set_state(array( 'curlUtils' => CurlUtils::__set_state(array( )), 'server' => 'https://accounts.google.com', 'scopes' => array ( 0 => 'https://www.googleapis.com/auth/adwords', ), )), 'isIncludeUtilitiesInUserAgent' => 'true', 'libVersion' => '12.0.0', 'libName' => 'Common-PHP', )), 3 => 'CSV', 4 => array ( 'version' => 'v201607', ), ), ), 6 => array ( 'file' => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting/DownloadCriteriaReportWithAwql.php',
'line' => 105, 'function' => 'DownloadCriteriaReportWithAwqlExample', 'args' => array ( 0 => AdWordsUser::__set_state(array( 'libVersion' => '12.0.0', 'libName' => 'AwApi-PHP', 'userAgent' => NULL, 'scopes' => array ( 0 => 'https://www.googleapis.com/auth/adwords', ), 'requestHeaderElements' => array ( 'userAgent' => ' (AwApi-PHP/12.0.0, Common-PHP/12.0.0, PHP/5.6.24)', 'clientCustomerId' => 'xxxxxxxxxxxx',
            'developerToken' => 'xxxx-xxxx',
), 'defaultServer' => 'https://adwords.google.com', 'defaultVersion' => 'v201607', 'logsDirectory' => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting',
'soapCompression' => true, 'soapCompressionLevel' => '1', 'wsdlCache' => 0, 'forceHttpVersion' => NULL, 'forceAddXsiTypes' => false, 'authServer' => 'https://accounts.google.com', 'oauth2Info' => array ( 'client_id' => 'xxxx-xxxx.apps.googleusercontent.com',
'client_secret' => 'xxxx',
'refresh_token' => '1/xxxx',
), 'oauth2Handler' => SimpleOAuth2Handler::__set_state(array( 'curlUtils' => CurlUtils::__set_state(array( )), 'server' => 'https://accounts.google.com', 'scopes' => array ( 0 => 'https://www.googleapis.com/auth/adwords', ), )), 'isIncludeUtilitiesInUserAgent' => 'true', 'libVersion' => '12.0.0', 'libName' => 'Common-PHP', )), 1 => '/home4/xxxx/public_html/burkett/googleads/examples/AdWords/v201607/Reporting/report.csv',
2 => 'CSV', ), ), ), 'previous' => NULL, ))

ToddN

unread,
Sep 20, 2016, 10:10:14 AM9/20/16
to AdWords API Forum
SOLVED:

I added CURL_IPRESOLVE_V4 in src/Google/Api/Ads/Common/Util/CurlUtil.php




 // Default options.
    $openBasedir = ini_get('open_basedir');
    $this->SetOpt($ch, CURLOPT_FOLLOWLOCATION, empty($openBasedir));
    $this->SetOpt($ch, CURLOPT_HEADER, false);
    $this->SetOpt($ch, CURLOPT_RETURNTRANSFER, true);
    $this->SetOpt($ch, CURLOPT_ENCODING, 'gzip');
    $this->SetOpt($ch, CURLOPT_USERAGENT, 'curl, gzip');
 //Added IPV4 SUPPORT
    $this->SetOpt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);

Nadine Sundquist (AdWords API Team)

unread,
Sep 20, 2016, 10:16:26 AM9/20/16
to AdWords API Forum
Hi Todd,

Thanks for updating the thread. I was just taking a look at this, and you beat me to it. Nice job!

Cheers,
Nadine, AdWords API Team
Reply all
Reply to author
Forward
0 new messages