I wrote the following code
$sandbox = 1;
# Provide AdWords login information.For security reason I have not given the
Proper adword information.But in my code i used the proper information.
$email = "MCC gmail";
$password = "MCC Gmail's password";
$useragent = "Ipsita Test Sample";
$applicationToken = "App Token";
$account_type = "GOOGLE";
$service = "adwords";
$clientEmail = "client_1+$email";
$namespace = 'https://sandbox.google.com/api/adwords/v13';
$developerToken = "$email++USD";


# Define SOAP headers.
$headers =
'<email>'.$email.'</email>'.
'<password>'.$password.'</password>'.
//'<clientEmail>'.$clientEmail.'</clientEmail>'.
'<useragent>'.$useragent.'</useragent>'.
'<developerToken>'.$developerToken.'</developerToken>'.
'<applicationToken>'.$applicationToken.'</applicationToken>';

$report_service = SoapClientFactory::GetClient($namespace .
'/ReportService?wsdl', 'wsdl');
$report_service->setHeaders($headers);
$report_job =
  '<selectedReportType>Campaign</selectedReportType>'.
  '<name>Sample Keyword Report</name>'.
  '<crossClient>true</crossClient>'.
  '<clientEmails></clientEmails>'.
  '<aggregationTypes>Summary</aggregationTypes>'.
  '<adWordsType>ContentOnly</adWordsType>'.
  '<keywordType>Broad</keywordType>'.
  '<startDay>2007-12-01</startDay>'.
  '<endDay>2010-01-22</endDay>'.
  '<selectedColumns>Campaign</selectedColumns>'.
  '<selectedColumns>AdGroup</selectedColumns>'.
  '<selectedColumns>Keyword</selectedColumns>'.
  '<selectedColumns>KeywordStatus</selectedColumns>'.
  '<selectedColumns>KeywordMinCPC</selectedColumns>'.
  '<selectedColumns>KeywordDestUrlDisplay</selectedColumns>'.
  '<selectedColumns>Impressions</selectedColumns>'.
  '<selectedColumns>Clicks</selectedColumns>'.
  '<selectedColumns>CTR</selectedColumns>'.
  '<selectedColumns>AveragePosition</selectedColumns>'.
  '<campaigns>1</campaigns>';
$request_xml =
  '<validateReportJob>'.
  '<job xmlns:impl="https://adwords.google.com/api/adwords/v13"; '.
  'xsi:type="impl:DefinedReportJob">'.$report_job.'</job>'.
  '</validateReportJob>';

# Validate report.
$report_service->call('validateReportJob', $request_xml);
//print '<pre>';print_r($report_service);exit;
$request_xml =
  '<scheduleReportJob>'.
  '<job xmlns:impl="https://adwords.google.com/api/adwords/v13"; '.
  'xsi:type="impl:DefinedReportJob">'.$report_job.'</job>'.
  '</scheduleReportJob>';
$job_id = $report_service->call('scheduleReportJob', $request_xml);
$job_id = $job_id['scheduleReportJobReturn'];
//print '<pre>';print_r($job_id);exit;
$request_xml =
'<getReportJobStatus>'.
'<reportJobId>'.$job_id.'</reportJobId>'.
'</getReportJobStatus>';
$status = $report_service->call('getReportJobStatus', $request_xml);
$status = $status['getReportJobStatusReturn'];
//print '<pre>';print_r($status);exit;
while ($status != 'Completed' and $status != 'Failed') {
  echo 'Report job status is "'.$status.'".'."\n";
  sleep(30);
  $status = $report_service->call('getReportJobStatus', $request_xml);
  $status = $status['getReportJobStatusReturn'];
}

if ($status == 'Failed') {
  echo 'Report job generation failed.' . "\n";
  return;
}
# Download report.
$request_xml =
  '<getGzipReportDownloadUrl>'.
  '<reportJobId>'.$job_id.'</reportJobId>'.
  '</getGzipReportDownloadUrl>';

$report_url = $report_service->call('getGzipReportDownloadUrl',
$request_xml);
$report_url = $report_url['getGzipReportDownloadUrlReturn'];
print '<pre>';print_r($report_url);exit;


The above code gives the below output:
Report job status is "Pending". Report job status is "InProgress". Report
job status is "InProgress".

https://sandbox.google.com/sandboxreports/defined.xml.gz


When I run the URL and download the file and then unzipped it.Then got
the XML file,which has all values containig 0.


Again

When I tried to fetch all the campaigns of the clients under the MCC
account.It gives error result.

Can any one please help me to make reports of the clients under an MCC account.

At least help me to fetch all the campaigns of the clients under an MCC.

-- 
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-...@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