AdWords
5.8K members online now
For issues or questions regarding logging in, account access, or account security
Guide Me
star_border
Reply

Unable to link clients to mcc using google adwords php Api

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hey All,

 

I am having issue with linking client accounts using php adwords api, I am using MCC account that have access level basic, and i am getting below error when i trying to call the API:

 

CODE:

require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
require_once '/functions.php';
$clientId = "634758580680-r7slmlgfjnd23gva894uaco600j7ihji.apps.googleusercontent.com";
$clientSecret = "uFtOVKXXeeT2ANcKLnAzYOpY";
$callbackUrl = "http://pivotalinfrastructure.com/gadwords/src/code.php";
$tokenFilename = "./tmp/oauth.txt";
//print_r($tokenFilename); 
// Create a new user and set the oAuth settings
$username = "mk****@gmail.com";
$password = "*********";
$developerToken = "tAMzVZMNvwFCC951BSnUXA";
 
$user = new AdWordsUser(null, $username, $password, $developerToken);
$user->SetOAuth2Info(array(
    "client_id" => $clientId,
    "client_secret" => $clientSecret
));

$authCode = $_REQUEST["code"];
$user->GetOAuth2AccessToken($authCode, $callbackUrl);

$managedCustomerService = $user->GetService("ManagedCustomerService", "v201209"); 
 
$customer = new ManagedCustomer();
$customer->name = "Test Account";
$customer->currencyCode = "USD";
$customer->dateTimeZone = 'Europe/London';
 
$operation = new ManagedCustomerOperation();
$operation->operator = 'ADD';
$operation->operand = $customer;
 
$operations = array($operation);
 
$accounts = $managedCustomerService->mutate($operations);
saveAuth($user, $tokenFilename);

RESPONSE

 

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://adwords.google.com/api/adwords/mcm/v201209/ManagedCustomerService?wsdl' : failed to load external entity "https://adwords.google.com/api/adwords/mcm/v201209/ManagedCustomerService?wsdl" in /home/techsquads/public_html/pivotalinfrastructure.com/gadwords/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php:163 Stack trace: #0 /home/techsquads/public_html/pivotalinfrastructure.com/gadwords/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php(163): SoapClient->SoapClient('https://adwords...', Array) #1 /home/techsquads/public_html/pivotalinfrastructure.com/gadwords/src/Google/Api/Ads/AdWords/Lib/AdWordsSoapClient.php(53): AdsSoapClient->__construct('https://adwords...', Array, Object(AdWordsUser), 'ManagedCustomer...', 'https://adwords...') #2 /home/techsquads/public_html/pivotalinfrastructure.com/gadwords/src/Google/Api/Ads/AdWords/v201209/ManagedCustomerService.php(2962): AdWordsSoapClient->__construct('https://adwords...', Array, in /home/techsquads/public_html/pivotalinfrastructure.com/gadwords/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php on line 163

 

Any help will be very appreciated,

 

Thanks.

Tech-Squads

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by Mini-CM (Community Manager)
March 2016

Re: Unable to link clients to mcc using google adwords php Api

Rising Star
# 4
Rising Star
Basic access is usually sufficient for development, that gets you 10,000 operations per day. You usually see an error like this from a simple typo. Make sure you have copied and pasted the developer token correctly from the AdWords API Center.
_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

View solution in original post

Re: Unable to link clients to mcc using google adwords php Api

Rising Star
# 2
Rising Star
Using old code. See https://developers.google.com/adwords/api/docs/reference/v201601/ManagedCustomerService
_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile

Re: Unable to link clients to mcc using google adwords php Api

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you for your reply.

 

Now we are using new version "v201509"

 Still facing issue. Smiley Frustrated

 

Fatal error: Uncaught SoapFault exception: [soap:Server] [QuotaCheckError.INVALID_TOKEN_HEADER @ ; trigger:'XXXXXX@gmail.com'] in /home/techsquads/public_html/pivotalinfrastructure.com/googleadd/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php:216 Stack trace: #0 /home/techsquads/public_html/pivotalinfrastructure.com/googleadd/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php(216): SoapClient->__soapCall('mutate', Array, NULL, Array, Array) #1 /home/techsquads/public_html/pivotalinfrastructure.com/googleadd/src/Google/Api/Ads/AdWords/v201509/ManagedCustomerService.php(4518): AdsSoapClient->__soapCall('mutate', Array) #2 /home/techsquads/public_html/pivotalinfrastructure.com/googleadd/create_client.php(29): ManagedCustomerService->mutate(Array) #3 {main} thrown in /home/techsquads/public_html/pivotalinfrastructure.com/googleadd/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php on line 216

also please suggest me : My Access level is "Basic access" is it enough for it ? or we need to go for "Apply for Standard Access".
 

Please help we will very appreciate you help.

 

Thanks

Tech-squads.

Marked as Best Answer.
Solution
Accepted by Mini-CM (Community Manager)
March 2016

Re: Unable to link clients to mcc using google adwords php Api

Rising Star
# 4
Rising Star
Basic access is usually sufficient for development, that gets you 10,000 operations per day. You usually see an error like this from a simple typo. Make sure you have copied and pasted the developer token correctly from the AdWords API Center.
_________________________________________________________________________
Director of Marketing | Nehmedia | Partner Profile