Hi!
Thanks for the answer!
I tried to link an account with php AdWords api (v201309):
Now the clientCustomerId is the id of the client, and the managerCustomerId = $this->user->GetClientCustomerId();
$this->user is the user of my MCC account. ( Like in the examples $user )
The code is:
// $data is prevalidated data from post.
private function linkingUser( & $data )
{
// Get the service, which loads the required classes.
$managedCustomerService =
$this->user->GetService('ManagedCustomerService', ADWORDS_VERSION);
$link = new ManagedCustomerLink();
$link->clientCustomerId = $data["clientId"]; //CLIENT_CID;
$link->pendingDescriptiveName = "PENDING: " . $data["clientId"];
$link->linkStatus = 'PENDING';
$link->managerCustomerId = $this->user->GetClientCustomerId(); //MANAGER_CID;
// Create operation.
$operation = new LinkOperation();
$operation->operand = $link;
$operation->operator = 'ADD';
$operations = array( $operation );
try
{
// Make the mutate request.
$result = $managedCustomerService->mutate( $operations );
}
catch (Exception $e) {
$message = $e->getMessage();
$this->errors[] = $message;
return FALSE;
}
if( empty( $result->value[0] ) )
{
$error = "Linking failed (garfx)." ;
$this->errors[] = $error;
return FALSE;
}
return $result->value[0];
}
Probleme 1.)
The result from "catch" section is: {"error" : "unauthorized_client"}
Probleme 2.)
curl probleme in API:
Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when
an open_basedir is set in
/var/www/vhosts/
grafxsoftware.com/httpdocs/gapi/src/Google/Api/Ads/Common/Util/CurlUtils.php
on line 107
Thanks for helping.
Grafx.
-----------------------------------------------------------------------------------------------------------------