donglu7816 2015-07-14 05:44
浏览 46

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

I am using the library googleads/googleads-php-lib from github.

I am trying to create a text ad, but I am getting an error that I cannot set the URL field. The code has been working for quite some time but has suddenly stopped due to this error.

The SoapFault exception that is thrown is:

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

My code is as follows:

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);

I am not sure what could be causing this error. Any help would be greatly appreciated.

  • 写回答

1条回答 默认 最新

  • doujionggan9570 2015-07-14 08:08
    关注

    got caught with that too. The problem seems to be that "url" is no longer supported, you have to use "targetUrls" of upgraded URLs API instead:

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

    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决