Problem with ClientLogin and google trends

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?