Hi, Thank you for your answer. I can run it now. The mistake I've done is that I followed the guidlines from Reporting Basics<https://developers.google.com/adwords/api/docs/guides/reporting>in the online developper guide, but I understand now that is for adHoc reports only. For standard reports, the php adwords library is enough.
Thank you. Le mardi 17 décembre 2013 04:38:46 UTC, Takeshi Hagikura (AdWords API Team) a écrit : > > Hi, > > The developerToken and clientCustomerId headers should be included in the > SOAP header, not the HTTP header. > Also I highly recommend using the PHP adwords > library<https://code.google.com/p/google-api-adwords-php/> if > you don't have a specific reason to avoid it. > It constructs the request on behalf of you instead of constructing a > request on your own. > > Best, > - Takeshi, AdWords API Team > > On Tuesday, December 10, 2013 8:58:40 PM UTC+9, Mohammed Nasri wrote: >> >> Hi, >> >> I am using php Adwords API (v201309) and I want to download the Adwords >> Reports, here is my php code: >> >> /* CODE : BEGIN */ >> >> $httpHeaders = array( >> "Authorization:OAUTH2_ACCESS_TOKEN=*MY_OAUTH2_CODE*", >> "developerToken:*MY_TOKEN*", >> "clientCustomerId:*MY_CUSTOMER_ID*" >> ); >> >> $reportDefinition = "<reportDefinition xmlns=\" >> https://adwords.google.com/api/adwords/cm/v201309\">"; >> $reportDefinition .= "<selector>"; >> $reportDefinition .= "<fields>CampaignId</fields>"; >> $reportDefinition .= "<fields>Date</fields>"; >> $reportDefinition .= "<fields>Impressions</fields>"; >> $reportDefinition .= "<fields>Clicks</fields>"; >> $reportDefinition .= "<fields>Cost</fields>"; >> $reportDefinition .= "<fields>Conversions</fields>"; >> $reportDefinition .= "<fields>AveragePosition</fields>"; >> $reportDefinition .= "<dateRange>"; >> $reportDefinition .= "<min>20130712</min>"; >> $reportDefinition .= "<max>20131010</max>"; >> $reportDefinition .= "</dateRange>"; >> $reportDefinition .= "</selector>"; >> $reportDefinition .= "<reportName>Ad Performance Report</reportName>"; >> $reportDefinition .= "<reportType>AD_PERFORMANCE_REPORT</reportType>"; >> $reportDefinition .= "<dateRangeType>CUSTOM_DATE</dateRangeType>"; >> $reportDefinition .= "<downloadFormat>XML</downloadFormat>"; >> $reportDefinition .= "</reportDefinition>"; >> >> $params = array("__rdxml" => $reportDefinition); >> >> $url = "https://adwords.google.com/api/adwords/reportdownload/v201309 >> "; >> >> $curl = curl_init(); >> curl_setopt($curl, CURLOPT_URL, $url); >> curl_setopt($curl, CURLOPT_HEADER, false); >> curl_setopt($curl, CURLOPT_POST, true); >> curl_setopt($curl, CURLOPT_POSTFIELDS, $params); >> curl_setopt($curl, CURLOPT_HTTPHEADER, $httpHeaders); >> curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); >> curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); >> curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 120); >> curl_setopt($curl, CURLOPT_TIMEOUT, 120); >> curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0); >> curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0); >> >> $reportData = curl_exec($curl); >> $err = curl_errno($curl); >> $errmsg = curl_error($curl) ; >> $header = curl_getinfo($curl); >> >> curl_close($curl); >> >> echo $reportData . "<br />"; >> >> /* CODE : END */ >> >> The result of my code is as follows : >> >> *AuthenticationError.USER_ID_INVALID<null>* >> >> I added the option userId to the httpHeaders params, but this gives me >> the following error message : >> >> *Not Found* >> Have you any idea that can helps me. >> >> Thank you. >> >> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://googleadsdeveloper.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 --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.