Hi
When i am try to configre the api for adword the facing the* error" Error: 
AuthenticationError.GOOGLE_ACCOUNT_COOKIE_INVALID<null>"*

please give me some solution or code using php if you have 

This is my code 

<?php
// Provide header information.
error_reporting(E_STRICT | E_ALL);

// Provide AdWords login information.
$email = 'rakesh.adwordme...@gmail.com';
$password = '*********';
$params = array(
    'Email' => $email,
    'Passwd' => $password,
    'accountType' => 'GOOGLE',
    'service' => 'adwords',
    'source' => 'AdWords API PHP Code Example');

$url = 'https://www.google.com/accounts/ClientLogin';

// Make request
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($ch);
curl_close($ch);

// Parse response.
$lines = explode("\n", $response);

//print_r($lines);
foreach ($lines as $line) {
  $parts = explode('=', $line, 2);
  if ($parts[0] == 'Auth') {
    $authToken = $parts[1];
  }
  if ($parts[0] == 'Error') {
    $error = $parts[1];
  }
}

// Display results.
if (isset($authToken)) {
  print 'Auth token: ' . $authToken . "\n";
  
} else if (isset($error)) {
  print 'Error: ' . $error . "\n";
}


$apiVersion = 'v201309';
$authToken = '$authToken';
$clientCustomerId = 
'452690394153-m8uu67k2a1icdi9bmg1bm2lo2gt96qd9.apps.googleusercontent.com';
$developerToken = 'AIzaSyD1FXc6h9q4hnhC4cJtxWQO5wmz-Kjg2EE';

// Create report definition XML.
$reportDefinition = 'SELECT CampaignId, Id, Impressions, Clicks, Cost ' .
  '  FROM ADGROUP_PERFORMANCE_REPORT ' .
  'WHERE Status IN ["ENABLED","PAUSED"]' .
  '  DURING LAST_7_DAYS';

$format = 'CSV';

// Create parameters.
$params = array(
  '__rdquery' => $reportDefinition,
  '__fmt' => $format,
);

// Create headers.
$headers = array();
$headers[]= 'Authorization: GoogleLogin auth=' . $authToken;
$headers[]= 'clientCustomerId: ' . $clientCustomerId;
$headers[]= 'developerToken: ' . $developerToken;

$downloadPath = 'report.csv';
$url = "https://adwords.google.com/api/adwords/reportdownload/$apiVersion";;

$file = fopen($downloadPath, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $file);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
fclose($file);

if ($code == 200) {
  printf("Report downloaded to: %s\n", $downloadPath);
} else {
  $file = fopen($downloadPath, 'r');
  $error = fread($file, 1024);
  fclose($file);
  printf("Error: %s\n", $error);
}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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.

Reply via email to