How to get started with AdWords API PHP library 4.7.0 / v201309 ?

620 views
Skip to first unread message

Ad_nu

unread,
Jan 5, 2014, 6:47:37 AM1/5/14
to adwor...@googlegroups.com

I haven’t use AdWords API before – so I’m trying to get started with sandbox version.
I Downloaded and installed the AdWords API PHP Client Library 4.7.0. to my server; I edited the user information in auth.ini and I also edited the settings.ini to use server: https://adwords-sandbox.google.com

After these “configurations” all example files (under v201309) – like EstimateKeywordTraffic.php – return just a blank page (no API errors or PHP errors).

What other configurations are required before I can make sandbox calls/requests?
Are there any simple test files available (other than the files included in client library) that can be used for checking if my server actually made any API requests?

Josh Radcliff (AdWords API Team)

unread,
Jan 6, 2014, 2:12:56 PM1/6/14
to adwor...@googlegroups.com
Hi,

The sandbox endpoint was deprecated a while back in favor of test accounts.


Regarding simple tests, the GetCampaigns example is a straightforward, read-only example that should indicate if you have everything set up correctly.  Also, when you run the sample it will create log files in the current directory that you can check to confirm your request went through.

Cheers,
Josh, AdWords API Team

Ad_nu

unread,
Jan 10, 2014, 12:05:35 PM1/10/14
to adwor...@googlegroups.com
OK – Thanks
I’m still getting blank pages though…

- I copied the developerToken from AdWords API center
- I created the client_id and client_secret  with API console

But when I run the “GetRefreshToken.php” page is blank.

Is this more of a server issue (at my end) – or is there other required information that I need to fill before I can get the refresh token?

Josh Radcliff (AdWords API Team)

unread,
Jan 10, 2014, 4:16:00 PM1/10/14
to adwor...@googlegroups.com
Hi,

All of our examples (including the GetRefreshToken.php) are meant to be run from the command line.  GetRefreshToken.php will write to stdout and prompt you to open a URL in your browser, then will wait on stdin for you to copy and paste the authorization code returned by the URL.  Once you've done that it will print instructions for modifying your auth.ini to stdout.

Are you running it from the command line or via some other mechanism?

Thanks,
Josh, AdWords API Team

Ad_nu

unread,
Jan 11, 2014, 8:48:01 AM1/11/14
to adwor...@googlegroups.com
OK – I created a new client ID (with API console) and executed the file in command line (using shell client). Now I can see couple of error messages and URL.

When I visit the URL I get error message:
invalid_client
no application name

Errors that are displayed after the file is executed:
Strict Standards: parse_ini_file(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CST/-6.0/no DST' instead in _MY_SERVER_PATH_/adwords_api/src/Google/Api/Ads/Common/Util/ApiPropertiesUtils.php on line 40

Warning: Error parsing _MY_SERVER_PATH_/adwords_api/src/Google/Api/Ads/AdWords/Lib/api.properties on line 15
 in _MY_SERVER_PATH_/adwords_api/src/Google/Api/Ads/Common/Util/ApiPropertiesUtils.php on line 40

Doubt Dolson

unread,
Jan 13, 2014, 2:11:00 AM1/13/14
to adwor...@googlegroups.com
This happens if :

 - auth.ini is not readable [Giving permission will solve it]
 - parse_ini_file function is not enabled [You can enable this funciton in php.ini file]
 - your path to auth.ini is not correct[You can echo the path on runtime and see if it is correct]

Hopefully, one of the above resolves your issue.
Reply all
Reply to author
Forward
0 new messages