php - file_get_contents & curl returns empty string for google trends -
i tried getting contents of url
http://www.google.com/trends/fetchcomponent?q=ex%20machina&cid=timeseries_graph_0&export=3
with file_get_contents , curl returns nothing, when went directly link shows content not problem api limits etc.
it worked once, not after subsequent calls
heres curl method used
function get_data($url) { $ch = curl_init(); //$timeout = 5; curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_proxyport, 3128); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, 0); $data = curl_exec($ch); curl_close($ch); return $data; }
i had similar problem google maps geocoder api in combination file_get_contents
, can find solution here:
google maps geocode api works via browser
try url: http://www.google.com/trends/fetchcomponent?q=ex+machina&cid=timeseries_graph_0&export=3
Comments
Post a Comment