Php 如何告诉Google Adwords API我查询的是我的MCC中的哪个客户端/帐户?
使用最新的PHP客户端库(v2.6.3),我似乎无法在我的MCC(我的客户端中心)帐户中获取客户端的所有活动 我可以通过以下方式轻松获取所有帐户:Php 如何告诉Google Adwords API我查询的是我的MCC中的哪个客户端/帐户?,php,google-ads-api,Php,Google Ads Api,使用最新的PHP客户端库(v2.6.3),我似乎无法在我的MCC(我的客户端中心)帐户中获取客户端的所有活动 我可以通过以下方式轻松获取所有帐户: $user = new AdWordsUser(NULL, $email, $password, $devToken, $applicationToken, $userAgent, NULL, $settingsFile); $service = $user->GetServicedAccountService(); $selector =
$user = new AdWordsUser(NULL, $email, $password, $devToken, $applicationToken, $userAgent, NULL, $settingsFile);
$service = $user->GetServicedAccountService();
$selector = new ServicedAccountSelector();
$selector->enablePaging = false;
$graph = $service->get($selector);
$accounts = $graph->accounts; // all accounts!
现在我已经这样做了,我想获得每个帐户中的所有活动。按文档说明的方式运行代码不起作用
// Get the CampaignService.
// ** Different than example because example calls a private method ** //
$campaignService = $user->GetCampaignService('v201101');
// Create selector.
$selector = new Selector();
$selector->fields = array('Id', 'Name');
$selector->ordering = array(new OrderBy('Name', 'ASCENDING'));
// Get all campaigns.
$page = $campaignService->get($selector);
// Display campaigns.
if (isset($page->entries)) {
foreach ($page->entries as $campaign) {
print 'Campaign with name "' . $campaign->name . '" and id "'
. $campaign->id . "\" was found.\n";
}
}
上面的代码只会抛出一个错误:
致命错误:未捕获的SoapFault异常:[soap:服务器]
QuotaCheckError.INVALID_TOKEN_头@message=null
stack=com.google.ads.api.authserver.common.AuthException位于
com.go
我觉得这失败的原因是GetCampaignService需要一个帐户的id…但我不知道如何指定这个id
我做错了什么?问题是我得到了错误的developerToken。我不认为
无效的\u令牌\u头
真的意味着它所说的,因为有些调用仍然使用错误的令牌。我不知道为什么