【发布时间】:2015-09-18 12:25:41
【问题描述】:
我一直在尝试使用 AdWords API。 我按照所有步骤从 https://developers.google.com/adwords/api/docs/guides/start?hl=es
我也以此为参考:
http://www.sagerock.com/blog/setting-google-adwords-api-access-first-time/
我以为我已经正确设置了,但是当我从示例文件夹运行 AddCampaigns.php 时,它返回: 发生错误:{ "error" : "internal_failure" } 来自:
try {
// Get AdWordsUser from credentials in "../auth.ini"
// relative to the AdWordsUser.php file's directory.
$user = new AdWordsUser();
$user->SetClientCustomerId("123-456-7891"); // Here I add the client test account ID
// Log every SOAP XML request and response.
$user->LogAll();
// Run the example.
AddCampaignsExample($user);
} catch (Exception $e) {
printf("An error has occurred: %s\n", $e->getMessage());
}
我的 auth.ini 文件如下所示:
developerToken = "my not yet aproved developer token"
userAgent = "my company name"
clientCustomerId = "123-456-7892" // Here I have the Manager test account ID
[OAUTH2]
client_id = "123123123123-asdfasdfasdfasdfasdfasdfasdfasdf.apps.googleusercontent.com"
client_secret = "My_client_secret"
refresh_token = "the refresh token i got from getrefreshtoken.php"
我不知道问题出在哪里。这些示例应该只能通过命令行工作,但我评论了这段代码:
//if (__FILE__ != realpath($_SERVER['PHP_SELF'])) {
// return;
//}
所以我可以使用浏览器在服务器上运行它。我不知道这是否是我得到错误的原因。有什么线索吗?
【问题讨论】:
标签: php oauth-2.0 google-ads-api