<?php
$path = dirname(__FILE__) . '/lib';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once dirname(__FILE__) . '/lib/Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
require_once dirname(__FILE__) . '/lib/Google/Api/Ads/AdWords/Util/ReportUtils.php';
define("OAUTH_CLIENT_ID", "[****]");
define("OAUTH_CLIENT_SECRET", "[****]");
define("OAUTH_ACCESS_TOKEN", "[****]");
define("OAUTH_REFRESH_TOKEN", "[*****]");
define("CUSTOMER_ACCOUNT_ID", "[*****]");
define("DEVELOPER_TOKEN", "[****]");
define("API_VERSION", "v201409");
$user = new AdWordsUser();
$user->SetDeveloperToken(DEVELOPER_TOKEN);
$user->SetClientCustomerId(CUSTOMER_ACCOUNT_ID);
print_r($user);
$user->SetOAuth2Info(array(
"client_id" => OAUTH_CLIENT_ID,
"client_secret" => OAUTH_CLIENT_SECRET,
"access_token" => OAUTH_ACCESS_TOKEN,
"refresh_token" => OAUTH_REFRESH_TOKEN
));
$user->LoadService('ReportDefinitionService', API_VERSION);
print_r($user);
// Get a list of campaigns
$campaignService = $user->GetService('CampaignService', API_VERSION);
$selector = new Selector();
$selector->fields = array('Id', 'Name');
$campaigns = $campaignService->get($selector);
print_r($campaigns);
?>