Get Google Page through PHP for Multiple URL

Wednesday, February 18, 2015

Here is the PHP Script for best solution for Finding PR for multiple URLs hope this very useful for your projects.


Google PageRank Script PHP

 Main Function (Download Full Script it Work like demo)

# Desc: function to check the Given URL with http:// and fetch PR
# Param: $url as String
# Depen: fetch_google_page_rank
# Return: Gogole Rank as Integer
function fetch_google_page_rank($url) {
 $url = strstr($url,"http://")? $url:"http://".$url;
    $fp = fsockopen("toolbarqueries.google.com", 80, $errno, $errstr, 30);
    if (!$fp) {
        echo "$errstr ($errno)<br />\n";
        } else {
        $out = "GET /tbl?client=navclient-auto&ch=".CheckHash(HashURL($url))."&features=Rank&q=info:".$url."&num=100&filter=0 HTTP/1.1\r\n";
        $out .= "Host: toolbarqueries.google.com\r\n";
        $out .= "User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 2.0.114-big; Windows XP 5.1)\r\n";
        $out .= "Connection: Close\r\n\r\n";
        fwrite($fp, $out);

        while (!feof($fp)) {
            $data = fgets($fp, 128);
            $pos = strpos($data, "Rank_");
        if($pos === false){} else{
                $pagerank = substr($data, $pos + 9);
            }
        }
        fclose($fp);
        return (int)$pagerank;
    }
} 


Download This Script     Live Demo     Download Script

1 comment:

Argalon Technologies said...

The Post was really very useful and thanks for sharing the information about this topic. PHP Development Company in Indore

Post a Comment