SOAP-ERROR: Parsing WSDL: Couldn't load from

為{幸葍}努か 提交于 2019-12-02 09:43:59

The problem is with SSL. If you are testing the API locally and getting this error, try a quick check - find in the AdWords PHP SDK the file named AdsSoapClientFactory.php and update around line 142 to add && false:

// SSL settings.
if ($soapSettings->getSslVerify() === true && false) { // explicitly disable SSL Verify

There are some useful comments below that code line as well. Of course, disabling SSL verification is not recommended for production systems, but at least this can be a quick solution to not lose your mind over why the damn API doesn't want to work.

If this indeed solves the problem, consider implementing it with SoapSettings. Undo the changes to AdsSoapClientFactory.php, and in your main file add:

use Google\AdsApi\Common\SoapSettingsBuilder;
[...]
$soapSettings= (new SoapSettingsBuilder())
    ->disableSslVerify()
    ->build();

$session = (new AdWordsSessionBuilder())
    ->fromFile()
    ->withOAuth2Credential($oAuth2Credential)
    ->withSoapSettings($soapSettings)
    ->build();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!