简体   繁体   中英

Javascript - save data from google trends url into PHP array

Hi search on the web but I don't find a solution.

I would save the data from this URL http://www.google.com/trends/fetchComponent?q=asdf,qwerty&cid=TIMESERIES_GRAPH_0&export=3 into a PHP array.

For now I have this code,

<?php

$url = 'http://www.google.com/trends/fetchComponent?q=asdf,qwerty&cid=TIMESERIES_GRAPH_0&export=3';

$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$responsedata = curl_exec($c);
curl_close($c);

echo $responsedata;


?>

but seems not to work.

Can someone help me?

Its JSON

remove // Data table response
google.visualization.Query.setResponse

and );

Then http://php.net/json_decode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM