***Announcing the new ads PHP client library***

743 views
Skip to first unread message

Thanet Knack Praneenararat (AdWords API Team)

unread,
Dec 21, 2016, 9:38:06 PM12/21/16
to AdWords API Forum
Hello ads PHP developers! Today we’re pleased to announce the stable release of the new ads PHP client library. This has been in beta for a while now, is a huge overhaul of the library, and offers a multitude of improvements. Please see our blog post for all the details!

Jesús Cárdenas

unread,
Dec 26, 2016, 3:01:53 AM12/26/16
to AdWords API Forum

Hello I need help, I go to the last version of the library and I have problems, I work with Laravel 4.2:

I write in console:
~$ cd $path/project/vendor/googleads/googleads-php-lib/examples/AdWords/v201609/AccountManagement
~$ php GetAccountHierarchy.php 

PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'All of 'clientId', 'clientSecret', and 'refreshToken' must be set when using installed/web application flow.' in $path/project/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/OAuth2TokenBuilder.php:179
Stack trace:
#0 $path/project/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/OAuth2TokenBuilder.php(134): Google\AdsApi\Common\OAuth2TokenBuilder->validate()
#1 $path/project/vendor/googleads/googleads-php-lib/examples/AdWords/v201609/AccountManagement/GetAccountHierarchy.php(134): Google\AdsApi\Common\OAuth2TokenBuilder->build()
#2 $path/project/vendor/googleads/googleads-php-lib/examples/AdWords/v201609/AccountManagement/GetAccountHierarchy.php(146): Google\AdsApi\Examples\AdWords\v201609\AccountManagement\GetAccountHierarchy::main()
#3 {main}
  thrown in $path/project/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/OAuth2TokenBuilder.php on line 179

Help me!

Jesús Cárdenas

unread,
Dec 26, 2016, 3:01:53 AM12/26/16
to AdWords API Forum
Hello, I was working with the 15.00 version of googleads-php-lib. Is it necessary to go to version 25.00 now?


El miércoles, 21 de diciembre de 2016, 23:38:06 (UTC-3), Thanet Knack Praneenararat (AdWords API Team) escribió:

Joyce Lava

unread,
Dec 27, 2016, 2:01:59 AM12/27/16
to AdWords API Forum
Hello Jesús,

Please create a new github issue with the above concern. 

Thanks,
Joyce, AdWords API Team

Dmytro S

unread,
Jan 4, 2017, 9:52:37 AM1/4/17
to AdWords API Forum

Hi!
 
Is where any simple way to put logs into subfolders with customerId ad current date as names without creating own logger?

Please, advise.

Thanks,
Dmytro.

Joyce Lava

unread,
Jan 4, 2017, 9:27:20 PM1/4/17
to AdWords API Forum
Hi Dmytro,

Could you please open a new thread so we can properly track your concern? Also, if you are referring to setting up the client library in your application, you may want to contact the github experts through the link I shared above.

alfonso payra

unread,
Jan 26, 2017, 2:35:55 PM1/26/17
to AdWords API Forum
jesus where you able to fix this problem? im getting same error but i did follow all steps. Im using vagrant with homestead but not using laravel

Jesús Cárdenas

unread,
Feb 24, 2017, 9:27:02 AM2/24/17
to AdWords API Forum

alfonso payra, The problem was the path of the adsapi_php.ini file, I used psr-4 to integrate the ads library into my project.
Adding the following lines in composer.json:
        "psr-4": {
            "Google\\AdsApi\\": "vendor/googleads/googleads-php-lib/src/Google/AdsApi",
        }

And in my controller I use the following way:
use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSession;
use ....

        //Path where the credentials were saved
        $path=app_path().'/services/google/adwords/adsapi_php.ini';

        // Generate a refreshable OAuth2 credential for authentication.
        $oAuth2Credential = (new OAuth2TokenBuilder())
           ->fromFile($path)
           ->build();

        // Construct an API session configured from a properties file and the OAuth2
        // credentials above.
        $session = (new AdWordsSessionBuilder())
           ->fromFile($path)
           ->withOAuth2Credential($oAuth2Credential)
           ->build();
...

Joven Albarida

unread,
Sep 11, 2017, 7:15:10 AM9/11/17
to AdWords API Forum
Guys,

I think the only steps that didnt explain on Adwords API people,  is that when in v201708 the adsapi_php use the HOME directory path, but downwards version was totally mind freak setting

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Sep 11, 2017, 1:22:42 PM9/11/17
to AdWords API Forum
Hi Joven, 

Are you facing any issues while using the v201708 version of the API? If so, could you please create a new thread with more details and logs explaining the issue?

Thanks,
Sreelakshmi, AdWords API Team
Reply all
Reply to author
Forward
0 new messages