Jump to content

Problem with ClientLogin and google trends


n3r0x

Recommended Posts

I manage to get the

SID=

LSID=

and

Auth=

 

using

 

$url[0] = "https://www.google.com/accounts/ClientLogin";
$url[1] = "http://www.google.com/trends/viz?q=".$keyword."&date=all&geo=all&graph=all_csv&sort=0&sa=N";
$header = array('Connection: keep-alive',
'Keep-Alive: 115',
'Accept: ',
'Accept-Charset: utf-8',
'Accept-Encoding: ',
'Accept-Language: en-us,en',
'Referer: ',
'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10'
);
$login = "Email={myemail}&Passwd={mypassword}&accountType=GOOGLE&source=CompanyTool-cURL-0.1&service=trends";

// Login
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url[0]);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$login);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch,CURLOPT_AUTOREFERER,true);

curl_setopt($ch,CURLOPT_HTTPHEADER,$header);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$text = curl_exec($ch);
print($text);
curl_close($ch);

 

but when i try to access $url[1] using:

 

// Auth string i got from previous connction
$auth = "XXXXXXXXXXXXXXXXXXXX";

// Add auth to header
$header = array('Authorization: GoogleLogin auth='.$auth.'');

// Start new curl session
$ch = curl_init();
// Set URL
curl_setopt($ch,CURLOPT_URL,$url[1]);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
// So that we get the output
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
// Auto referer (not needed but added anyway "jic")
curl_setopt($ch,CURLOPT_AUTOREFERER,true);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);	
$text = curl_exec($ch);
curl_close($ch);
print($text);

 

it says something like:

 

"You must login to download data from google trends"

 

Anyone know what´s wrong or have another way to download csv files from Google trends?

Link to comment
Share on other sites

  • 8 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.