googleads / googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP
Apache License 2.0
656 stars 769 forks source link

Fatal error inside Guzzle when requesting account information #365

Closed acmwallace closed 7 years ago

acmwallace commented 7 years ago

I am trying to upgrade to the latest version of the Google Ads system, and am running into an issue with Guzzle. a) I grabbed all the files with composer, but moved them into our file tree, because otherwise, the changes would be rather horrific in terms if the time required. All the files are inside a "lib" directory inside our code tree (which is where the older Google Ads PHP API files were). b) I am trying to get a list of the accounts from a managed customer service.

My code:

$oAuth2Credential = ( new OAuth2TokenBuilder() ) ->fromFile( $this->CONFIG_FILE_PATH ) ->build();

$adwords_session = ( new AdWordsSessionBuilder() ) ->fromFile( $this->CONFIG_FILE_PATH ) ->withOAuth2Credential($oAuth2Credential) ->build();

$adWordsServices = new AdWordsServices();

$managedCustomerService = $adwords_services->get( $adwords_session, ManagedCustomerService::class );

$selector = new Selector(); $selector->setFields( [ 'CustomerId', 'Name' ] ); $selector->setOrdering( [new OrderBy('CustomerId', SortOrder::ASCENDING)] ); $selector->setPaging(new Paging(0, 50));

// Make the get request. $page = $managedCustomerService->get($selector);

Unfortunately, the "get($selector)" line throws an exception:

exception 'Exception' with message 'exception 'InvalidArgumentException' with message 'URI must be a string or UriInterface' in /home/httpd/idxv3/lib/GuzzleHttp/Psr7/functions.php:62

Not sure what's going on. THat's pretty deep inside the codebase. Any thoughts?

thanks, Andy

fiboknacky commented 7 years ago

Hi Andy,

I'd recommend to install using composer on the server. Or else you may need to ensure all dependencies are fetched correctly. My initial guess is that your Guzzle might not be of a correct version. I've seen some cases where users just have other libs installed on their systems and installed Guzzle is not a right one that is needed by this library.

Is it possible for you to run GetAccountHierarchy example?

Best, Knack

acmwallace commented 7 years ago

Arg. We have almost 20 webservers. In order to make this work by using Composer to install it, I'm not even sure what hoops I'm going to have to go through to get it on all those machines (which come and go at the whim of Google Cloud Services).

I'll see if I can set up my machine as a webserver to test the example.

-- IHOUSEWEB Inc. 8950 Cal Center Dr bldg. 1 suite 202 Sacramento, CA 95826

Andy Wallace | Senior Software Engineer | 916-246-7777 | awallace@ihouseweb.com

On Wed, Sep 20, 2017 at 11:13 AM, Thanet Knack Praneenararat < notifications@github.com> wrote:

Hi Andy,

I'd recommend to install using composer on the server. Or else you may need to ensure all dependencies are fetched correctly. My initial guess is that your Guzzle might not be of a correct version. I've seen some cases where users just have other libs installed on their systems and installed Guzzle is not a right one that is needed by this library.

Is it possible for you to run GetAccountHierarchy https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201708/AccountManagement/GetAccountHierarchy.php example?

Best, Knack

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/googleads/googleads-php-lib/issues/365#issuecomment-330935749, or mute the thread https://github.com/notifications/unsubscribe-auth/AcmgTg0QNe037XMh3G7TIL_eRnF3BlgHks5skVXfgaJpZM4PePTu .

fiboknacky commented 7 years ago

Hello @acmwallace

Is there anything we can help on our side? If not, I'll close this issue soon.

Best, Knack

fiboknacky commented 7 years ago

Close due to inactivity.