PageRank Kaynağı?
12
●1.080
- 01-07-2010, 22:28:23pagerank sorgulama scripti var. kaynak kodlarına bakarak anlayabilirsin.
- 01-07-2010, 22:34:16function getrank($url, $prefix="info:", $datacenter="www.google.com") { //This is the function used to get the PageRank value.
//If $prefix is "info:", then the Toolbar pagerank will be returned.
//$datacenter sets the datacenter to get the results from. e.g., "www.google.com", "216.239.53.99", "66.102.11.99".
$url = $prefix.$url;
$ch = GoogleCH(strord($url)); //Get the Google checksum for $url using the GoogleCH function.
$file = "http://$datacenter/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url";
//To get the Crawl Date instead of the PageRank, change "&features=Rank" to "&features=Crawldate"
//To get detailed XML results, remove "&features=Rank"
$oldlevel = error_reporting(0); //Suppress error reporting temporarily.
$data = file($file);
error_reporting($oldlevel); //Restart error reporting.
if(!$data || preg_match("/(.*)\.(.*)/i", $url)==0) return "N/A"; //If the Google data is unavailable, or the URL is invalid, return "N/A".
//The preg_match check is a very basic url validator that only checks if the URL has a period in it.
$rankarray = explode (":", $data[2]); //There are two line breaks before the PageRank data on the Google page.
$rank = trim($rankarray[2]); //Trim whitespace and line breaks.
if($rank=="") return "N/A"; //Return N/A if no rank.
return $rank;
}
function getrealrank($url, $datacenter="www.google.com"){
$ch = GoogleCH(strord($url));
$array = xmltoarray("http://$datacenter/search?client=navclient-auto&ch=6$ch&q=$url");
$infoarray = $array['GSP'][0]['RES'][0]['R'];
$nonwwwurl = str_replace("www.", "", $url);
$urlpermutationsarray = array($url, "http://".$url, "http://www.".$url, $url."/", "http://".$url."/", "http://www.".$url."/", $nonwwwurl, "http://".$nonwwwurl, "http://www.".$nonwwwurl, $nonwwwurl."/", "http://".$nonwwwurl."/", "http://www.".$nonwwwurl."/");
for($i=0; $i<count($infoarray); $i++){
$urlU = $infoarray[$i]['U']; //U is the URL. UE is the 'clean' URL.
$urlrank = $infoarray[$i]['RK'];
foreach($urlpermutationsarray as $permutation){
if(strtolower($permutation)==strtolower($urlU)) return $urlrank; //Case insensitive match.
}
}
return "Unknown"; //If no matches found.
}
kodun sadece 2 tane fonksyonu bunlar. şimdi biraz daha açık sanırım... - 02-07-2010, 13:50:38Kimlik doğrulama veya yönetimden onay bekliyor.biraz araştırma sonucunda bu linke ulaştım. .Net kaynak kod isteyenler için buyrun link :
codeproject