-
Üyelik
25.06.2016
-
Yaş/Cinsiyet
37 / E
-
Meslek
full stack developer
-
Konum
İstanbul Avrupa
-
Ad Soyad
S** Ç**
-
Mesajlar
334
-
Beğeniler
35 / 93
-
Ticaret
0, (%0)
ben php ile cekmistim.. google apisini kullaniyorsun.. kod asagida..
case "getResults":
$adres = "https://www.googleapis.com/customsearch/v1";
$q = $_POST['keyword'];
$cx = "007246239120058448275:6n5_2aia2ku";
$key = "";//google api key..
$fields = "items(link,title)";
$num = 10;
$start = 1;
$sonuclar = array();
for ($i = 1; $i< 6; $i++)
{
if ($i > 1) $start = ($num * $i) + 1;
$requestURL = $adres."?q=".$q."&cx=".$cx."&fields=".$fields."&start=".$start."&num=".$num."&key=".$key;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $requestURL);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // set user agent
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = str_replace(array("\n", "\r", "\t"), NULL, curl_exec($ch));
curl_close($ch);
$sonuclar[] = $data;
}
echo json_encode($sonuclar);
break;