class google_pagerank{
var $domain = '';
var $resource = false;
function __construct($domain){
$this->domain = $domain;
}
/*Google*/
public function getPageRank(){
$this->hash = $this->CheckHash($this->HashUrl($this->domain));
$UrlData = array(
'client' => 'navclient-auto',
'ch' => $this->hash,
'features' => 'Rank',
'q' =>'info:'.$this->domain
);
$UrlData = http_build_query($UrlData,'','&');
$this->getPage = sprintf("http://google.com/search?%s",$UrlData);
/*Parse the results*/
$this->gResults = $this->GetDataFromDomain($this->getPage);
$this->_pos = strpos($this->gResults,"Rank_");
return ($this->_pos === false) ? false : substr($this->gResults, $this->_pos + 9);
}
private function StrToNum($Str, $Check, $Magic){
/* Once Removed*/
}
private function HashURL($String){
/*Twice Removed*/
$T2 = (((($Check1 & 0xFFFFC000) << 4) | ($Check1 & 0x3C00)) << 0xA) | ($Check2 & 0xF0F0000 );
return ($T1 | $T2);
}
private function CheckHash($Hashnum){
$CheckByte = 0;
$Flag = 0;
$HashStr = sprintf('%u', $Hashnum);
$length = strlen($HashStr);
for($i = $length - 1; $i >= 0; $i --){
$Re = $HashStr{$i};
if(1 === ($Flag % 2)){
$Re += $Re;
$Re = (int)($Re / 10) + ($Re % 10);
}
$CheckByte += $Re;
$Flag ++;
}
$CheckByte %= 10;
if (0 !== $CheckByte){
$CheckByte = 10 - $CheckByte;
if(1 === ($Flag % 2)){
if(1 === ($CheckByte % 2)){
$CheckByte += 9;
}
$CheckByte >>= 1;
}
}
return '7'.$CheckByte.$HashStr;
}
/*End Google*/
/*Global Functions*/
private function GetDataFromDomain($Url){
$this->resource = curl_init($Url);
/*Settings*/
$this->CurlOptions = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_ENCODING => "",
CURLOPT_USERAGENT => "Litewarez (Curl Client)",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_VERBOSE => 1
);
curl_setopt_array($this->resource,$this->CurlOptions);
return curl_exec($this->resource);
}
}
?>