Hello All 

I am trying to run the add campaing example in the sandbox enviroment but 
keep getting [AuthorizationError.USER_PERMISSION_DENIED @] 
The code I am using is the following....can anyone help? (I should not here 
that the customers that get initialized always have customerId = 0 is this 
normal?)

$user = new AdWordsUser(null, 'm...@gmail.com', 'mypassword', 
'm...@gmail.com++USD');
$user->SetDefaultServer("https://adwords-sandbox.google.com/";); 
$user->LogAll();
$user->SetClientId(null);


try {
$campaignService = $user->GetService("CampaignService", 'v201109');
$page = $campaignService->get(new Selector());
} catch (Exception $e) {}


$accountService = $user->GetService("ServicedAccountService", 'v201109');
$selector = new ServicedAccountSelector();
$page = $accountService->get($selector);

foreach ($page->accounts as $account) {
print "Customer ID: {$account->customerId}\n";
}


$customerId = $page->accounts[0]->customerId;
$user->SetClientId($customerId);


$campaignService = $user->GetService("CampaignService", 'v201109');

$campaign = new Campaign();
$campaign->name = "Test Sandbox Account";
$campaign->status = "ACTIVE";
$campaign->biddingStrategy = new ManualCPC();

$budget = new Budget();
$budget->period = 'DAILY';
$budget->amount = new Money((float) 10000000);
$budget->deliveryMethod = 'STANDARD';
$campaign->budget = $budget;

$networkSetting = new NetworkSetting();
$networkSetting->targetGoogleSearch = TRUE;
$campaign->networkSetting = $networkSetting;

$operation = new CampaignOperation();
$operation->operand = $campaign;
$operation->operator = 'ADD';

$operations = array($operation);
$result = $campaignService->mutate($operations);

print_r($result);

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to