Hi Oceanus, Thanks for your reply, but these two functions will provide hourly trends. function grabTrends() { //for USA ->"http://www.google.com/trends/hottrends/atom/hourly" $arr = $this->curlGrab("http://www.google.co.in/trends/hottrends/atom/hourly"); //patterns to find keys and links $ptnkeys = '|&sa=X">(.*?)</a>|'; $ptnlinks='/<a href=\"([^\"]*)\">(.*)<\/a>/iU'; preg_match_all( $ptnkeys, $arr['page'], $keys ); preg_match_all( $ptnlinks, $arr['page'], $links ); $keys=$keys[1]; $links=$links[1]; for($i=0;$i<count($keys);$i++) { $contents[count($contents)]=array($keys[$i],$links[$i]); } return $contents; } function curlGrab( $url) { //---- functio to get data from a website--/ $ch = curl_init( $url ); curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_COOKIEJAR, 'cookies.txt' ); curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01;Windows NT 5.0)" ); $arr[ 'page' ] = curl_exec( $ch ); return $arr; } But Now i need to get full trends for previous day, i couln't find any feed to provide this. Do you know???
Hi, There is a php library here to read google trends and you can define the time range. For example: $gs=newGSession($guser, $gpass); $gs->authenticate(); $gt=new GTrends($gs,'en'); $gt->addTerm('something1')->setTime('2017-4-18 2017-04-19'); $gt->getGraph('csv'));