// Get the service, which loads the required classes. $reportDefinitionService = $user->GetService('ReportDefinitionService', 'v201109'); // The type of the report to get fields for. $reportType = 'CAMPAIGN_PERFORMANCE_REPORT'; // Get report fields. $reportDefinitionFields = $reportDefinitionService->getReportFields($reportType); // Display results. printf("The report type '%s' contains the following fields:\n", $reportType); foreach ($reportDefinitionFields as $reportDefinitionField) { printf(' %s (%s)', $reportDefinitionField->fieldName, $reportDefinitionField->fieldType); if (isset($reportDefinitionField->enumValues)) { printf(' := [%s]', implode(', ', $reportDefinitionField->enumValues)); } print "\n"; } } // Don't run the example if the file is being included. if (__FILE__ != realpath($_SERVER['PHP_SELF'])) { return; } try { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Log every SOAP XML request and response. $user->LogAll(); // Run the example. GetReportFieldsExample($user); } catch (Exception $e) { printf("An error has occurred: %s\n", $e->getMessage()); }
public function testGetReportFieldsExample() { GetReportFieldsExample($this->user); }