Hi and thanks for replying.

Hmm ...i think i have got them commented out. Perhaps you would oblige me by 
looking at my code?

Here is my AddAdgroupPerformanceReport.php

<?php

// You can set the include path to src directory or reference
// AdWordsUser.php directly via require_once.
// $path = '/path/to/aw_api_php_lib/src';
$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);


require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
require_once 'Google/Api/Ads/AdWords/Util/ReportUtils.php';


try {
  // Get AdWordsUser from credentials in "../auth.ini"
  // relative to the AdWordsUser.php file's directory.
  $user = new AdWordsUser();

  // Log SOAP XML request and response.
  $user->LogDefaults();

  // Get the GetReportDefinitionService.
  $reportDefinitionService = $user->GetReportDefinitionService('v201101');

  
 // $adGroupId = (float) '';
//$startDate = '';
//$endDate = '';

  // Create selector.
  $selector = new Selector();
  $selector->fields = array('Date','CampaignName', 'CampaignStatus', 
'AdGroupName', 'Status',  'Impressions', 'Clicks', 'Cost', 
'AveragePosition','ConversionsManyPerClick');
  //S$selector->dateRange = new DateRange($startDate, $endDate);

  // Create predicates.
  //$adGroupIdPredicate = new Predicate('AdGroupId', 'EQUALS', 
array($adGroupId));
  //$selector->predicates = array($adGroupIdPredicate);

  // Create report definition.
  $reportDefinition = new ReportDefinition();
  $reportDefinition->reportName = 'ADGROUP performance report #' . time();
  $reportDefinition->dateRangeType = 'YESTERDAY';
  $reportDefinition->reportType = 'ADGROUP_PERFORMANCE_REPORT';
  $reportDefinition->downloadFormat = 'CSV';
  $reportDefinition->selector = $selector;


  // Create operations.
  $operation = new ReportDefinitionOperation();
  $operation->operand = $reportDefinition;
  $operation->operator = 'ADD';

  $operations = array($operation);

  // Add report definition.
  $result = $reportDefinitionService->mutate($operations);

  // Display report definitions.
  if ($result != null) {
    foreach ($result as $reportDefinition) {
      printf("Report definition with name '%s' and id '%s' was added.\n",
       $reportDefinition->reportName, $reportDefinition->id);   
       
$reportDefinitionId = $reportDefinition->id;
   $fileName = 'tv_g_ppc_data.csv';
$path = dirname(__FILE__) . '/data/' . $fileName;


  // Download report.
  ReportUtils::DownloadReport($reportDefinitionId, $path, $user);

  printf("Report with definition id '%s' was downloaded to '%s'.\n",
      $reportDefinitionId, $path, $fileName);


     } 
 
} 
  
     
 else {
    print "No report definitions were added.\n";
    
  }
} catch (Exception $e) {
  print $e->getMessage();
}

  
This generated a report id of 1302769510

I entered this id into downloadreport.php

<?php
error_reporting(E_STRICT | E_ALL);

// You can set the include path to src directory or reference
// AdWordsUser.php directly via require_once.
// $path = '/path/to/aw_api_php_lib/src';
$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
require_once 'Google/Api/Ads/AdWords/Util/ReportUtils.php';

try {
  // Get AdWordsUser from credentials in "../auth.ini"
  // relative to the AdWordsUser.php file's directory.
  $user = new AdWordsUser();

  // Log SOAP XML request and response.
  $user->LogDefaults();

  $reportDefinitionId = '1302681607';
  $fileName = 'tv_g_ppc_data.csv';

  $path = dirname(__FILE__) . '/data/' . $fileName;

  // Download report.
  ReportUtils::DownloadReport($reportDefinitionId, $path, $user);

  printf("Report with definition id '%s' was downloaded to '%s'.\n",
      $reportDefinitionId, $path, $fileName);
} catch (Exception $e) {
  print $e->getMessage();
}

Not sure what I am doing wrong here? It's probably very simple!

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