Hi, I'm a bit confused. Can we use OAuth only or ClientToken only? Or do we have to mix?
Thanks, On Oct 19, 2:32 pm, Reed <powell.r...@gmail.com> wrote: > THANK YOU!!!!!! That php code was a great help! Below is a slightly > modified version of it that doesn't use OAUTH, and saves the csv file. > -reed > > <?php > > /* Replace with legitimate credentials */ > $authToken = 'blahblahblah '; > $clientCustomerId = 'xxx-xxx-xxxx'; > > /* Report Definition */ > $xml = '<reportDefinition> > <selector> > <fields>Date</fields> > <fields>CampaignId</fields> > <fields>AdGroupId</fields> > <fields>Id</fields> > > <fields>Impressions</fields> > <fields>Clicks</fields> > <fields>Cost</fields> > <fields>Criteria</fields> > <fields>CriteriaType</fields> > <fields>CriteriaDestinationUrl</fields> > > <fields>Status</fields> > > <dateRange> > <min>20111001</min> > <max>20111031</max> > </dateRange> > </selector> > <reportName>Test Criteria Report</reportName> > <reportType>CRITERIA_PERFORMANCE_REPORT</reportType> > <dateRangeType>CUSTOM_DATE</dateRangeType> > <downloadFormat>CSV</downloadFormat> > </reportDefinition>'; > > /* Authentication Headers */ > $headers = array(); > $url = 'https://adwords.google.com/api/adwords/reportdownload/ > v201109'; > /* > $oauthInfo = $AdWordsUser->GetOAuthInfo(); > $oauthParameters = OAuthUtils::GetSignedRequestParameters($oauthInfo, > $url); > $OAuthHeader = > OAuthUtils::FormatParametersForHeader($oauthParameters); > */ > > $headers[] = 'Authorization: ' . 'GoogleLogin auth=' . $authToken; > $headers[] = 'clientCustomerId: ' . $clientCustomerId; > $headers[] = 'returnMoneyInMicros: true'; > > /* Report Definition */ > $post = array(); > $post['__rdxml'] = $xml; > > /* cURL Request */ > $ch = curl_init(); > curl_setopt($ch, CURLOPT_URL, 'https://adwords.google.com/api/adwords/ > reportdownload/v201109'); > curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); > curl_setopt($ch, CURLOPT_HEADER, 0); > curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); > curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); > curl_setopt($ch, CURLOPT_POST, 1); > curl_setopt($ch, CURLOPT_POSTFIELDS, $post); > > // Get Response > $response = curl_exec($ch); > $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); > > /* Debugging */ > print '<pre>Headers:<br />'; > print_r($headers); > print '<hr />XML:<br />'; > print htmlentities($xml); > print '<hr />'; > print 'HTTP Code: ' . $code . '<hr />'; > print htmlentities($response); > print '<hr />Errors:<br />'; > $errors = array( 'errno' => curl_errno($ch), 'error' => > curl_error($ch)) ; > print_r($errors); > > print '<hr />Saving File:<br />'; > $myFile = "c:\temp\reed\testFile.csv"; > $fh = fopen($myFile, 'w') or die("can't open file"); > fwrite($fh, htmlentities($response)); > fclose($fh); > > $end; -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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