Hi everyone,

I wrote a program using the Google Adwords API want to retrieve the 
campaign information for a specific customer client ID.

This is my code.

<?php
require_once dirname(dirname(__FILE__)) . "/init.php";

function GetCampaignsTest(AdWordsUser $user) {
  $user->SetClientCustomerId('XXX-XXX-XXX');

  $campaignService =
      $user->GetService("CampaignService", ADWORDS_VERSION);

  $selector = new Selector();
  $selector->fields = array('Id', 'Name', 'Status');
  $selector->ordering[] = new OrderBy('Name', 'ASCENDING');
  $selector->paging = new Paging(0, 
AdWordsConstants::RECOMMENDED_PAGE_SIZE);

  do {
    $page = $campaignService->get($selector);

    if (isset($page->entries)) {
      foreach ($page->entries as $campaign) {
        echo $campaign->id . ': ' . $campaign->name . ' ' . 
$campaign->status . "\n";
      }
    } else {
      print "No campaigns were found.\n";
    }

    $selector->paging->startIndex += 
AdWordsConstants::RECOMMENDED_PAGE_SIZE;
  } while ($page->totalNumEntries > $selector->paging->startIndex);
}

try {
  $user = new AdWordsUser();
  $user->LogAll();
  GetCampaignsTest($user);
} catch (Exception $e) {
  printf("An error has occurred: %s\n", $e->getMessage());
}
?>

The resutls ...
  "No campaigns were found."

Why campaigns is were not found?
What is wrong with it?

Notice:
The "SetClientCustomerId" is not MCC account. It is using the customer 
client ID(CID) that was allocated to the individual.
Of course, the campaign when viewed in Google Adwords management screen of 
the customer client ID has been set.
Google AdWords API v201509 use.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/152e5a0c-e5cd-4048-b705-3788e0d1be3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to