Hot Searches

Setelah semua script peralatan telah selesai, sekarang kita exploitasi google trends, sehingga keyword dapat segera dikenali oleh bah google


<?php

function getRelated(){
$cookieFile = "cookies.txt";
if(!file_exists($cookieFile)) {
	$fh = fopen($cookieFile, "w");
	fwrite($fh, "");
	fclose($fh);
}
$cari= rawurlencode($_GET['judul']);
$url="http://www.google.com/trends/fetchComponent?q=$cari&cid=RISING_QUERIES_0_0"; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
									"Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
									"Accept-Encoding:gzip,deflate,sdch",
									"Accept-Language:en-US,en;q=0.8,id;q=0.6",
									"Cache-Control:max-age=0",
									"Connection:keep-alive"									
    ));
curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36");

$data = curl_exec($ch); 


$i=0;
$rel="";
$buf="";
$a=explode("<a",$data);
foreach($a as $b){
	 $c=explode(";\">",$b);
	 
	  	foreach($c as $d){
	  		  $e=explode(";\">",$d);
	  		  foreach($e as $f){
							  $i++;
							  if ($i%2==0){
							  	$g=explode(">",$f);
							  	      $buf=trim(str_replace("</a","",$g[1]));
								  					$rel.= "<a href='".BASE_URL.str_replace(" ","_",$buf)."'>$buf</a>|";
								  				}								  				  		  	
	  		  	}
	  		}
	   
	}
	return $rel;
}

echo getRelated();

0 comments:

Post a Comment

 

Copyright 2013 Download Lagu Gratis: Hot Searches Template by Casino Critic | Ping!. Powered by Blogger