Merhaba, php'den anlayan arkadaşlar şuna bir bakarsa sevinirim.Arşivdeydi önceden çalışan bir sıra bulucuydu.Şuanda sonuçları göstermemektedir.Şunu çalışır halde paylaşan arkadaş hem bir teşekkür hemde bir r10+ hakkediyor.
index.php
<!DOCTYPE html>
<html lang="TR"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Google Sıra Bulucu </title>
<link rel="stylesheet" type="text/css" href="/main.css">
</head>
<center>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><img src="logo.png" alt="logo"><form action= "sira.php" method="post">
<font size="2">Siteniz: <input type="text" name="site"></font><br>
<font size="2">Kelime: <input type="text" name="kelime"></font><br>
<font size="2">Sonuc Sayisi:</b><select name="deger"></font>
<option value="100">100'e Kadar</option>
<option value="500">500'e Kadar</option>
</select><br>
<input type="submit" value="Gonder ">
</form>
<br><br><br><br><br>
</center>
sira.php
<?php
class GoogleSiraBulucu{
// Sinif Baslangici
public function cek($url,$proxy){
$useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
$referer = 'http://www.google.com/';
$ch = curl_init();
$zaman = 0;
curl_setopt($ch,CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $zaman);
curl_setopt ($ch, CURLOPT_REFERER, $referer);
curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);
$rmx = curl_exec($ch);
curl_close($ch);
return $rmx;
}
public function get($start,$kelime,$proxy){
$googleapi = "http://www.google.com.tr/custom?hl=tr&client=pub-5224501972594997&start=".$start."&num=100&q=".$kelime;
preg_match_all('#<li>(.*?)</li>#',$this->cek($googleapi,$proxy),$results);
$sira = 1;
$tekrar = 0;
$sayfa = 0;
foreach($results[1] as $result){
preg_match('#<a class="l" href="(.*?)" onmousedown="return#',$result,$link);
$links = str_replace('http://','',$link[1]);
$links = str_replace('https://','',$links);
$links = str_replace('www.','',$links);
$bol = explode('/',$links);
if($bol){
$x = $bol[0];
}else{
$x = $links;
}
@$data .= $link[1]."<br>";
}
return $data;
}
public function Response($site,$kelime,$proxy,$sayi){
$kelime = urlencode($kelime);
$start = $sayi/100;
for($i=0;$i<$start;$i++){
$b = $i*100;
$data[] = $this->get($b,$kelime,$proxy);
}
@$birlestir = join("", $data);
$d = explode("<br>",$birlestir);
array_pop($d);
$kactane = 0;
foreach($d as $key => $value) {
$key = $key+1;
if(strpos($value,$site)){
$kactane = $kactane+1;
}
}
foreach($d as $skey => $svalue) {
$skey = $skey+1;
if(strpos($svalue,$site)){
$ilk = $skey;
break;
}
}if($kactane>0){
echo '<b><font color="green">Siteniz '.$skey.'. Sırada Toplamda '.$kactane.' Sonuç İçinde Bulundu.</font></b><br><br>';
}else{
echo '<b><font color="red">Siteniz 100 Sonuç içinde Bulunamadı!</font></b><br><br>';
}
foreach($d as $rkey => $rvalue) {
$rkey = $rkey+1;
echo ''.$rkey.' - <a href="'.$rvalue.'" target="_blank">'.substr($rvalue,0,45).'</a><br>';
}
}
// Sinif Bitisi
}
$sira = new GoogleSiraBulucu();
$proxy="";
$sayi = $deger;
$deger = $_POST["deger"];
$hakan = $_POST["site"];
$hakan1 = $_POST["kelime"];
echo $sira->Response ($hakan, $hakan1 ,$proxy,$deger);
?>