Hi!!
I've sucessfully executed sample examples provided in PHP API.
In my localhost Windows environment I just overrided SSL validation setting it to false (I know it's not recommeded). I also had to manually specify clientCustomerId because the value specified in the .ini file was not taken into account.
$soapSettings = (new SoapSettingsBuilder())
->disableSslVerify()
->build();
$session = (new AdWordsSessionBuilder())
->fromFile()
->withSoapSettings($soapSettings)
->withOAuth2Credential($oAuth2Credential)
->withClientCustomerId("123-456-7890")
->build();
Sample GetCampaings.php or GetReportFields worked like a charm.
The problem arises when executing sample DownloadCriteriaReportWithSelector. Again there are problems with SSL validation.
Looks like the http calls made with Guzzle does not take into account the disableSslVerify() in SoapSettings. When executing I get this error.
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Error creating resource: [message] fopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
[file] E:\xampp\htdocs\apiadwords\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php
[line] 329
[message] fopen(): Failed to enable crypto
[file] E:\xampp\htdocs\apiadwords\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php
[line] 329
[file] E:\xampp\htdocs\apiadwords\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php
[line] 329' in E:\xampp\htdocs\apiadwords\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php:252
Stack trace:
#0 E:\xampp\htdocs\apiadwords\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php(341): GuzzleHttp\Handler\StreamHandler->createResource(Object(Closure))
#1 E:\xampp\htdocs\apiadwords\vendor\guzzlehttp\guzzle\sr in E:\xampp\htdocs\apiadwords\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 52
I just "solved it" (not a solution I know) by hacking Guzzle's StreamHandler and forcing enable SSL validation to false.
// Ensure SSL is verified by default
if (!isset($options['verify'])) {
$options['verify'] = false;
}
// Horrible hack to not to do
$options['verify'] = false;
How could I solve this in a more appropiate way?
Thanks a lot !!!!