How download with p开发者_如何学JAVAhp google trends/insign cvs file?
reproduce:
go to : http://www.google.com/trends?q=london%2C+paris&ctab=0&geo=all&date=all&sort=0
in this page exist option to download cvs file that have all query result data by click. I need to that by php.
Thanks,
Yosef
look on the file_get_contents
function
<?php
$csv = file_get_contents('http://www.google.com/trends/viz?q=london,+paris&date=all&geo=all&graph=all_csv&sort=0&sa=N');
echo $csv;
?>
$query = 'london, paris';
$csvFile = 'http://www.google.com/trends/viz?q='.urlencode($query).'&date=all&geo=all&graph=all_csv&sort=0&sa=N';
file_put_contents(file_get_contents($link),
str_replace(array(',', ' ') '-', $query).'.cvs');
精彩评论