Hi, If all you want is to print out the first 25 ad groups, then change the code to:
1. Construct a Paging object with new Paging(0, 25) [as you have done] 2. Remove the do and while lines so that the example stops after processing the first page of 25 results If that's not what you're trying to do, could you provide some more details on your use case? Thanks, Josh, AdWords API Team On Thursday, March 13, 2014 12:53:04 PM UTC-4, la...@techknowspace.com wrote: > > Hey, > > It returns all the adGroups in the selected campaign. > > I tried this approach to which did not work as well > > $selector->paging = new Paging(); > $selector->paging->startIndex=0; > $selector->paging->numberResults = 25; > > > Any idea what i'm doing wrong? > > Thanks > > On Tuesday, March 11, 2014 11:17:34 AM UTC-4, la...@techknowspace.comwrote: >> >> *v201402* >> >> function GetAdGroupsExample(AdWordsUser $user, $campaignId) { >> // Get the service, which loads the required classes. >> $adGroupService = $user->GetService('AdGroupService', ADWORDS_VERSION); >> >> // Create selector. >> $selector = new Selector(); >> $selector->fields = array('Id', 'Name'); >> $selector->ordering[] = new OrderBy('Name', 'ASCENDING'); >> >> // Create predicates. >> $selector->predicates[] = >> new Predicate('CampaignId', 'IN', array($campaignId)); >> >> // Create paging controls. >> $selector->paging = new Paging(0, >> AdWordsConstants::RECOMMENDED_PAGE_SIZE); >> >> do { >> // Make the get request. >> $page = $adGroupService->get($selector); >> >> // Display results. >> if (isset($page->entries)) { >> foreach ($page->entries as $adGroup) { >> printf("Ad group with name '%s' and ID '%s' was found.\n", >> $adGroup->name, $adGroup->id); >> } >> } else { >> print "No ad groups were found.\n"; >> } >> >> // Advance the paging index. >> $selector->paging->startIndex += >> AdWordsConstants::RECOMMENDED_PAGE_SIZE; >> } while ($page->totalNumEntries > $selector->paging->startIndex); >> } >> >> >> >> >> >> ------------------ >> >> I'm trying to get 100 results at the time >> >> Thanks >> > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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. For more options, visit https://groups.google.com/d/optout.