Google Adwords: Configuration Not Loading Properly

谁说胖子不能爱 提交于 2020-01-17 07:27:25

问题


I'm following this tutorial: https://developers.google.com/adwords/api/docs/guides/first-api-call#make_your_first_api_call_1

And I'm at that step I linked. When I go into terminal and run php

path/to/GetCampaigns.php it returns this error: `PHP Fatal error: Uncaught exception 'Google\AdsApi\AdWords\v201609\cm\ApiException' with message '[QuotaCheckError.INVALID_TOKEN_HEADER @ ; trigger:'_dev_token_']' in /var/www/AdwordsAPI/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php:39

I assume that it is not finding my adsapi_php.ini file that I set up through this, which was suggested in the main tutorial: https://github.com/googleads/googleads-php-lib

If I go to browser instead and try to access the page, and then return to my logs, it returns this error in logs:

[Wed Dec 28 12:25:52 2016] [error] [client 70.162.15.23] PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Config file not found as specified: 'adsapi_php.ini'. Home directory could not be located so it was not searched.' in /var/www/AdwordsAPI/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/ConfigurationLoader.php:71\nStack trace:\n#0 /var/www/AdwordsAPI/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/OAuth2TokenBuilder.php(51): Google\AdsApi\Common\ConfigurationLoader->fromFile('adsapi_php.ini')\n#1 /var/www/AdwordsAPI/vendor/googleads/googleads-php-lib/examples/AdWords/v201609/BasicOperations/GetCampaigns.php(76): Google\AdsApi\Common\OAuth2TokenBuilder->fromFile()\n#2 /var/www/AdwordsAPI/vendor/googleads/googleads-php-lib/examples/AdWords/v201609/BasicOperations/GetCampaigns.php(89): Google\AdsApi\Examples\AdWords\v201609\BasicOperations\GetCampaigns::main()\n#3 {main}\n thrown in /var/www/AdwordsAPI/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/ConfigurationLoader.php on line 71

If I'm missing anything let me know.


回答1:


It seems within the week, documentation has changed, and I was following two different versions of the documentation. All I needed to do was regenerate the developer token and update my .ini file. Everything is working fine now.



来源:https://stackoverflow.com/questions/41368499/google-adwords-configuration-not-loading-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!