N
N
neeil2016-08-31 13:17:43
PHP
neeil, 2016-08-31 13:17:43

How to get adwords account xml report via curl?

in general, it’s interesting that it’s possible to make a request via curl something like this, only to get an account report, the command they have seems to be for this Account Performance Report,
I didn’t find the documentation, I already received all the tokens, but I can’t make a request otherwise. thank you all for understanding)

$xml = '<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201506">
  <selector>
    <fields>CampaignId</fields>
    <fields>Id</fields>
    <fields>Impressions</fields>
    <fields>Clicks</fields>
    <fields>Cost</fields>
    <predicates>
      <field>Status</field>
      <operator>IN</operator>
      <values>ENABLED</values>
      <values>PAUSED</values>
    </predicates>
  </selector>
  <reportName>Custom Adgroup Performance Report</reportName>
  <reportType>ADGROUP_PERFORMANCE_REPORT</reportType>
  <dateRangeType>LAST_7_DAYS</dateRangeType>
  <downloadFormat>CSV</downloadFormat>
</reportDefinition>';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://adwords.google.com/api/adwords/reportdownload/v201506");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question