Hi,
to walk through an adwords-account and get all data (campaigns,
adgroups, criterions) i use the following code (just pseudo-code for
understanding):
try {
$adwordsUser = new AdWordsUser();
} catch (Exception $e) {
die();
}
$campaignService = $adwordsUser->GetCampaignService('v200909');
$selector = new CampaignSelector();
$page = $campaignService->get($selector);
$allCampaigns = $page->entries;
foreach($allCampaigns AS $campaign) {
$adGroupService = $adwordsUser->GetAdGroupService('v200909');
$selector = new AdGroupSelector();
$selector->campaignId = $campaign->id;
$page = $adGroupService->get($selector);
$allAdGroups = $page->entries;
foreach($allAdGroups as $adgroup) {
.....
}
}
Is it better to load the $adGroupService (such as other services) only
once within the try{}-block? Or are there any disadvantages?
Kind Regards
Andreas
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Have you migrated to v200909 yet?
The v13 sunset is on April 22, 2010.
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en