GAMEchief
07-05-2009, 07:15 PM
function page_rank($site)
{
$site = preg_replace("/^\w+:\/\//", "", $site);
if (strpos($site, '/') !== false)
$site = substr($site, 0, strpos($site, '/'));
$pr = file_get_contents("http://www.google.com/search?client=navclient-auto&ch=1-1&features=Rank&q=info:" . rawurlencode($site));
if (($pr) && (preg_match("/^Rank_\d+:\d+:(\d+)$/", $pr, $matches)))
return (int) $matches[1];
return 0;
}to use:
page_rank("http://gamingmedley.com");
Just pass the website (any format, works with and without http and/or www) as the first argument.
{
$site = preg_replace("/^\w+:\/\//", "", $site);
if (strpos($site, '/') !== false)
$site = substr($site, 0, strpos($site, '/'));
$pr = file_get_contents("http://www.google.com/search?client=navclient-auto&ch=1-1&features=Rank&q=info:" . rawurlencode($site));
if (($pr) && (preg_match("/^Rank_\d+:\d+:(\d+)$/", $pr, $matches)))
return (int) $matches[1];
return 0;
}to use:
page_rank("http://gamingmedley.com");
Just pass the website (any format, works with and without http and/or www) as the first argument.