GoogleAds PHP SoapFault - AdError.CANNOT_SET_FIELD @ operations [0] .operand.ad.url

时间:2015-07-14 05:44:04

标签: php google-adwords

我正在使用github中的库googleads/googleads-php-lib

我正在尝试制作文字广告,但是我收到一条错误,我无法设置网址字段。代码已经工作了很长时间,但由于这个错误突然停止了。

抛出的SoapFault异常是:

  

[AdError.CANNOT_SET_FIELD @ operations [0] .operand.ad.url]

我的代码如下:

require_once('Google/Api/Ads/AdWords/Lib/AdWordsUser.php');
$developerToken = '*removed*';
$clientCustomerId = '*removed*';
$userAgent = 'test';
$settingsIniPath = './vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/settings.ini';
$oAuth = array(
    'client_id' => '*removed*',
    'client_secret' => '*removed*',
    'refresh_token' => '*removed*',
);
$adWordsUser = new AdWordsUser(null, $developerToken, $userAgent, $clientCustomerId, $settingsIniPath, $oAuth);
$adWordsUser->SetDefaultVersion('v201409');
$adGroupId = *removed*;

$textAd = new TextAd();
$textAd->headline = 'headline text';
$textAd->description1 = 'description1 text';
$textAd->description2 = 'description2 text';
$textAd->displayUrl = 'www.example.com';
$textAd->url = 'http://www.example.com/';

$adGroupAd = new AdGroupAd($adGroupId, $textAd);
$operations = array(new AdGroupAdOperation($adGroupAd, null, 'ADD'));
$adGroupAdService = $adWordsUser->GetService('AdGroupAdService');
$result = $adGroupAdService->mutate($operations);

我不确定导致此错误的原因。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

也被抓住了。问题似乎是" url"不再支持,你必须使用" targetUrls"改为升级的URL API:

http://googleadsdeveloper.blogspot.cz/2015/05/reminder-adwords-destination-urls-will.html