PHP ok?  This is what I have in my notes:

//adWords API stuff - see GetAllAdGroupCriteria.php
//make array containing all adGroupId's
        $query06 = "select distinct(adGroupId) from $db.$prefix"."keywords
where ExternalCustomerId='$customerId' and
( month(date)=month(date(now())) or month(date)=month(date(now()-
interval 1 month)) ) group by keywordText";
        $result06 = $mysqli->query($query06);
        while ( $row06 = $result06->fetch_object() ) {
                $distinctAdGroupId[] = (float) $row06->adGroupId;       }
try {
  // Get AdWordsUser from credentials in "../auth.ini"
  // relative to the AdWordsUser.php file's directory.
  $user = new AdWordsUser();
                $user->SetClientId($customerId);
  // Log SOAP XML request and response.
  $user->LogDefaults();
  // Get the AdGroupCriterionService.
  $adGroupCriterionService = $user-
>GetAdGroupCriterionService('v201101');
  // Create selector.
  $selector = new Selector();
  $selector->fields = array('Id', 'KeywordText', 'MaxCpc',
'FirstPageCpc');
  //to get all possible fields, see
http://code.google.com/apis/adwords/docs/appendix/selectorfields.html#v201101-AdGroupCriterionService
  $selector->ordering = array(new OrderBy('AdGroupId', 'ASCENDING'));
  // Create predicates.
  $adGroupIdPredicate = new Predicate('AdGroupId', 'IN',
$distinctAdGroupId);
  $selector->predicates = array($adGroupIdPredicate);
  // Get all ad group criteria.
  $page = $adGroupCriterionService->get($selector);
} catch (Exception $e) {
  print $e->getMessage();
}
//*/

I do that first to create an object with all the keyword information I
might need to grab for purposes of my script, then I use a function to
search through that data and return an object with whatever
information I need:

//*
function getLastMonthMaxCPC($keywordId, $page5) {

        foreach ($page5 as $ad) {

                if ( $ad->Id == $keywordId ) {

                        $maxCPC2 = new stdClass;
                        if(isset($ad->avgCPC)) {
                        $maxCPC2->avgCPC = $ad->avgCPC;
                        $maxCPC2->convRate = $ad->convRate;     }
                        return $maxCPC2;
                        }
    }
}
//*/



On Nov 1, 6:14 am, Nikhil Gaur <nik...@ranosys.com> wrote:
> Hi,
>
> In my application I want to fetch keyword report, but it takes too
> much time so I am planning to create a separate operation for some
> special keywords. For these keywords I will not fetch reports but I'll
> fetch their keyword object which contains complete keyword details
> like average cpc, impression etc.
>
> This kind of thing is possible in adCenter API so I am assuming that
> this will also be available in Adwords as well. In adCenter we can
> fetch individual keyword abject and then check theor details.
>
> If any one knows how to fetch keyword object in Adwords please reply.
>
> Thanks

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