$adSchedule->dayOfWeek = $days[i]; Should this say $day rather than $days[i]?
On Thursday, 22 October 2015 20:57:57 UTC+1, Doug Silksone wrote: > > Hey guys - First post here. > > Purpose of this code section is to set Ad Scheduling between 00:00 - 04:00 > every weekday. Unfortunately, the code I've written has been breaking the > rest of my PHP script. > At first glance, can you see where I'm going wrong? > > > $campaignCriterionService = $user->GetService('CampaignCriterionService' > , ADWORDS_VERSION); > > $operations = array(); > $campaignID = "XXX-XXX-XXXXX"; > $days = array( > 'MONDAY', > 'TUESDAY', > 'WEDNESDAY', > 'THURSDAY', > 'FRIDAY' > ); > > foreach($days as $day) { > //Set Variables > $adSchedule = new AdSchedule(); > $adSchedule->dayOfWeek = $days[i]; > $adSchedule->startHour = 0; > $adSchedule->startMinute = 'ZERO' ; > $adSchedule->endHour = 4; > $adSchedule->endMinute = 'ZERO' ; > > $adScheduleCriterion = new AdScheduleCriterion(); > $adScheduleCriterion->campaignId = $campaignID; > $adScheduleCriterion->criterion = $adSchedule; > > $adScheduleCriteria[] = $adScheduleCriterion; > //Create the Operation > $operation = new CampaignCriterionOperation(); > $operation->operand = $adScheduleCriterion; > $operation->operator = 'ADD'; > $operations[] = $operation; > > } > //Mutate! > $result = $CampaignCriterionService->mutate($operations); > > > > > > > > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/01fed972-f5f0-4015-9ab7-db80527cd395%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.