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();
}
?>


On 25 янв, 12:20, Alistair Austen <alistair.aus...@gmail.com> wrote:
> Hi,
>
> Does anyone have a code snippet to show how to set the schedule for a
> campaign?  For example I need to set the campaign to run;
>
> Mon-Thurs 7am-8pm
> Fri 7am-5pm
> Sat-Sun Not run
>
> I've looked through the examples included in the API and didn't spot this
> one and also found another reference to this question in the forum but the
> content the answer links to doesn't exist anymore.
>
> Many thanks in advance,
>
> Alistair

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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