Orkyd a dit:dmoz classe ses sites selon leur pr
function PageRankDownload($yourURL, $Checksum) {
$fp2 = fsockopen("toolbarqueries.google.fr", 80, $errno, $errstr, 30);
if (!$fp2) {
echo "Erreur : $errstr ($errno)<br />\n";
} else {
$outt = "GET /search?client=navclient-auto&ch=".$Checksum."&ie=UTF-8&oe=UTF-8&features=Rank&q=info:".$yourURL." HTTP/1.1\r\n";
$outt .= "Host: toolbarqueries.google.fr \r\n";
$outt .= "Connection: Close\r\n\r\n";
}
fwrite($fp2, $outt);
$myStrPage2 = "";
while (!feof($fp2)) {
$myStrPage2 .= fgets($fp2, 128);
}
$PageRANK = trim(substr($myStrPage2,strpos($myStrPage2, 'Rank_1:1:')+9,2));
return $PageRANK;
}
<?php
function PageRankDownload($yourURL, $Checksum) {
$fp2 = fsockopen("toolbarqueries.google.fr", 80, $errno, $errstr, 30);
if (!$fp2) {
echo "Erreur : $errstr ($errno)<br />\n";
} else {
$outt = "GET /search?client=navclient-auto&ch=".$Checksum."&ie=UTF-8&oe=UTF-8&features=Rank&q=info:".$yourURL." HTTP/1.1\r\n";
$outt .= "Host: toolbarqueries.google.fr \r\n";
$outt .= "Connection: Close\r\n\r\n";
}
fwrite($fp2, $outt);
$myStrPage2 = "";
while (!feof($fp2)) {
$myStrPage2 .= fgets($fp2, 128);
}
$PageRANK = trim(substr($myStrPage2,strpos($myStrPage2, 'Rank_1:1:')+9,2));
return $PageRANK;
}
header('Content-Type:image/png');
$maxWidth = 70;
$maxHeight = 12;
$img = ImageCreate($maxWidth, $maxHeight);
$white = imagecolorallocate($img, 255,255,255);
$black = imagecolorallocate($img, 0,0,0);
$green = imagecolorallocate($img, 0,128,0);
ImageLine($img,0,0,0,($maxHeight-1),$black);
ImageLine($img,0,($maxHeight-1),($maxWidth-1),($maxHeight-1),$black);
ImageLine($img,($maxWidth-1),($maxHeight-1),($maxWidth-1),0,$black);
ImageLine($img,($maxWidth-1),0,0,0,$black);
$PageRank = PageRankDownload($url, $checksum);
settype($PageRank, int);
ImageLine($img, ($PageRank)*8, 0, ($PageRank)*8 , ($maxHeight-1),$black);
ImageFill($img, (($PageRank)*8)-1, 1, $green);
ImageString($img, 2, 25,-1,$PageRank.'/10',$black);
ImagePng($img);
?>