I've created code for you (it assumes that file located in lib/
examples/v201109/ directory:
<?php
error_reporting(E_STRICT | E_ALL);
// You can set the include path to src directory or reference
// AdWordsUser.php directly via require_once.
// $path = '/path/to/aw_api_php_lib/src';
$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
try {
// Get AdWordsUser from credentials in "../auth.ini"
// relative to the AdWordsUser.php file's directory.
$user = new AdWordsUser();
// Log SOAP XML request and response.
$user->LogDefaults();
// Get the CampaignCriterionService.
$campaignCriterionService =
$user->GetService('CampaignTargetService', 'v201109');
$campaignId = 'INSERT_CAMPAIGN_ID_HERE;
$bidMutliplier = 1.0; // This mean that we should use usual bid
$adScheduleDays = array();
// Mon-Thur 7 a.m -
8.pm
foreach(array('MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY') as $day)
{
$adScheduleDays[] = new AdScheduleTarget($day, 7, 'ZERO', 20,
'ZERO', $bidMutliplier);
}
// Fri 7 am - 5 pm
$adScheduleDays[] = new AdScheduleTarget('FRIDAY', 7, 'ZERO',
17,'ZERO', $bidMutliplier);
// Sat, sun - not run
// Do not set it at all
$adSchedule = array();
$adSchedule[] = new AdScheduleTargetList($adScheduleDays,
$campaignId);
// 'SET' new schedule operations. (Not ADD)
$operations = array();
foreach ($adSchedule as $adScheduleOperation) {
$operations[] = new
CampaignTargetOperation($adScheduleOperation, 'SET');
}
// Make the mutate request.
$result = $campaignCriterionService->mutate($operations);
var_dump($result);
} catch (Exception $e) {
print $e->getMessage();
}
?>