PR值全称为PageRankPageRank(网页级别)是Google用于评测一个网页重要性的一种方法在揉合了诸如Title标识和Keywords标识等所有其它因素之后Google通过PageRank来调整结果使那些更具重要性的网页在搜索结果中另网站排名获得提升从而提高搜索结果的相关性和质量PR值最高为一般PR值达到就算是一个不错的网站了
PageRank是google搜索排名算法中的一个组成部分级别从到级级为满分PR值越高说明该网页在搜索排名中的地位越重要也就是说在其他条件相同的情况下PR值高的网站在google搜索结果的排名中有优先权
< ?php
// Edit this to your website url:
$myWebSite = ;
define(
GMAG
xE
A
);
//unsigned shift right
function zeroFill($a
$b) {
$z = hexdec(
);
if ($z & $a) {
$a = ($a>>
);
$a &= (~$z);
$a |=
x
;
$a = ($a>>($b
));
} else {
$a = ($a>>$b);
}
return $a;
}
function mix($a
$b
$c) {
$a
= $b; $a
= $c; $a ^= (zeroFill($c
));
$b
= $c; $b
= $a; $b ^= ($a< <
);
$c
= $a; $c
= $b; $c ^= (zeroFill($b
));
$a
= $b; $a
= $c; $a ^= (zeroFill($c
));
$b
= $c; $b
= $a; $b ^= ($a<<
);
$c
= $a; $c
= $b; $c ^= (zeroFill($b
));
$a
= $b; $a
= $c; $a ^= (zeroFill($c
));
$b
= $c; $b
= $a; $b ^= ($a<<
);
$c
= $a; $c
= $b; $c ^= (zeroFill($b
));
return array($a
$b
$c);
}
function GCH($url
$length=null
$init=GMAG) {
if(is_null($length)) {
$length = sizeof($url);
}
$a = $b =
x
E
B
;
$c = $init;
$k =
;
$len = $length;
while($len >=
) {
$a += ($url[$k+
] +($url[$k+
]< <
) +($url[$k+
]<<
) +($url[$k+
]<<
));
$b += ($url[$k+
] +($url[$k+
]<<
) +($url[$k+
]<<
) +($url[$k+
]<<
));
$c += ($url[$k+
] +($url[$k+
]<<
) +($url[$k+
]<<
)+($url[$k+
]<<
));
$mix = mix($a
$b
$c);
$a = $mix[
]; $b = $mix[
]; $c = $mix[
];
$k +=
;
$len
=
;
}
$c += $length;
switch($len) {/* all the case statements fall through */
case
: $c+=($url[$k+
]<<
);
case
: $c+=($url[$k+
]<<
);
case
: $c+=($url[$k+
]<<
);
/* the first byte of c is reserved for the length */
case
: $b+=($url[$k+
]<<
);
case
: $b+=($url[$k+
]<<
);
case
: $b+=($url[$k+
]<<
);
case
: $b+=($url[$k+
]);
case
: $a+=($url[$k+
]<<
);
case
: $a+=($url[$k+
]<<
);
case
: $a+=($url[$k+
]<<
);
case
: $a+=($url[$k+
]);
/* case
: nothing left to add */
}
$mix = mix($a
$b
$c);
/*
report the result */
return $mix[
];
}
//converts a string into an array of integers containing the numeric value of the char
function strord($string) {
for($i=
;$i<strlen($string);$i++) {
$result[$i] = ord($string{$i});
}
return $result;
}
function getPR($_url) {
$url =
info:
$_url;
$ch = GCH(strord($url));
$url=
info:
urlencode($_url);
$pr = file("$ch&ie=UTF
&oe=UTF
&features=Rank&q=$url");
$pr_str = implode(""
$pr);
return substr($pr_str
strrpos($pr_str
":")+
);
}
echo "<br>The PR of $myWebsite is: "
getPR($myWebSite);
?>