CPCStrategy / bing-ads-sdk-php

Composer friendly version of the Bing Ads SDK for PHP
Apache License 2.0
7 stars 9 forks source link

'Call to a member function GetAccountsInfo() on a non-object' #11

Closed maxlen closed 10 years ago

maxlen commented 10 years ago

When I trying to get AccountInfo - have an error: 'Call to a member function GetAccountsInfo() on a non-object'

And if I use not $proxy = new ClientProxy($username, $password, $token, $wsdl); but $proxy = ClientProxy::ConstructWithAccountId($wsdl, $username, $password, $token, $accountId, $authenticationToken);

I have error 'Invalid client data. Check the SOAP fault details for more information'

onema commented 10 years ago

Just so you know I don't maintain the code for the library, I just make it available through github and packagist.

With that said I can tell you that you cannot create an instance of the proxy using new.

You must create the proxy using the "factory methods" like ConstructWithAccountId. Now I have found out that you must use specific credentials and have access to use the API in order to get access to it. It is a complex process and I could post a tutorial on what is required.

Ultimately the best documentation are the examples and API docs provided by Microsoft. You should see a link to these in the read me file.

Best of luck!

maxlen commented 10 years ago

Yes. Please post tutorial

onema commented 10 years ago

I do not use Username/Password combination to access the API instead I use an OAuth flow. See the following resources, These links have sample code you can use to get the access required by the API:

Getting Started With the Bing Ads API http://msdn.microsoft.com/en-us/library/bing-ads-getting-started.aspx

Server Side OAuth Authentication in PHP http://msdn.microsoft.com/en-US/library/dn632721.aspx

Bing Client Id and Client Secret These credentials are available after an application is created for the account: https://account.live.com/developers/applications

Bing Developer Key It can be obtain at this URL https://developers.bingads.microsoft.com/Account

maxlen commented 10 years ago

ok. Thank you. I already understood this. The only problem - I can't add "ads" by this instruction http://msdn.microsoft.com/en-us/library/dn629676.aspx But compaign , groups and keywords - no problem.