It's actually quite easy as the main difference is that you don't need to 
create a report before downloading it anymore. Something like the following 
should work (although I haven't tested it):

$adGroupId = (float) $_GET['id'];
$adGroupName = $_GET['name'];

# Create ad group predicate.
$adGroupPredicate = new Predicate();
$adGroupPredicate->field = 'AdGroupId';
$adGroupPredicate->operator = 'EQUALS';
$adGroupPredicate->values = array($adGroupId);

# Create selector.
$selector = new Selector();
$selector->fields = array("AdGroupName", "KeywordText", "Impressions", 
"Ctr", "AveragePosition");
$selector->predicates = array($adGroupPredicate);

# Create report definition.
$reportDefinition = new ReportDefinition();
$reportDefinition->reportName = 'NEW Keywords performance report 
'.$adGroupName.' for adgroup #' . $adGroupId . ' @' . time();
$reportDefinition->reportType = 'KEYWORDS_PERFORMANCE_REPORT';
$reportDefinition->downloadFormat = 'CSVFOREXCEL';
$reportDefinition->dateRangeType = 'LAST_7_DAYS';
$reportDefinition->selector = $selector;

// You don't need to create a report, just download it:
$fileName = 'INSERT_OUTPUT_FILE_NAME_HERE';
$path = dirname(__FILE__) . '/' . $fileName;
  $options = array('version' => 'v201109', 'returnMoneyInMicros' => TRUE);
  ReportUtils::DownloadReport($reportDefinition, $path, $user, $options);

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