PHP Classes

Google Rank Checker: Retrieve the Google page rank of a given URL

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (23)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 67%Total: 14,564 This week: 1All time: 67 This week: 560Down
Version License PHP version Categories
googlepr 1.0.0Public Domain4Searching, Web services, SEO
Description 

Author

This class can be used to retrieve the Google page rank of a page with a given URL.

The Page Rank is a family of algorithms for assigning numerical weights to hyperlinked documents (or web pages) indexed by a search engine.

Its properties are much discussed by search engine optimization (SEO) experts. The page rank system is used by the popular search engine Google to help determining the relevance of a page.

The page rank is considered to determine the order of presentation of different locations in search engine result pages.

This class accesses the Google servers and queries the page rank of a given URL. The page rank value returned by the class is a number between 0 and 10.

Innovation Award
PHP Programming Innovation award nominee
November 2005
Number 2


Prize: One copy of the Zend Studio
Google search result pages has become one of the most important sources of visitors to content Web sites.

To maximize the number of site visitors, it is important that the pages of the site appear first in as many Google search result pages as possible.

The Google search results are sorted by a factor named page rank. Higher ranked pages have greater chances of appearing first in Google search result pages.

The Google page rank is computed according to a patented algorithm that takes in account incoming and outgoing links of the page.

The exact page rank formula and factors that affect its value are not publically known. However, the rank of a page is informed by the Google Toolbar from queries that it performs to the Google servers.

This class can query Google servers and retrieve the rank of a given page. This way anybody can determine the page rank without needing to install the Google Toolbar.

Manuel Lemos
Picture of Emre Odabas
Name: Emre Odabas <contact>
Classes: 1 package by
Country: Turkey Turkey
Age: 45
All time rank: 1301 in Turkey Turkey
Week rank: 416 Down9 in Turkey Turkey Down
Innovation award
Innovation award
Nominee: 1x

Recommendations

page rank
check site page rank google

Example

<?php

/********************************************
*
* Include class file
*
********************************************/
include_once("class.googlepr.php");

/********************************************
*
* Init class
*
********************************************/
$gpr = new GooglePR();

/********************************************
*
* Set Options
*
********************************************/
//Override user agent
//Default : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204";
$gpr->userAgent = $_SERVER["HTTP_USER_AGENT"];

//Override cache directory
//You must permissions to create directories and files in cache directory
//Default : "/tmp";
$gpr->cacheDir = dirname(__FILE__)."/prcache";

//Override maximum cache age (in seconds)
//Cache file will be expired in $maxCacheAge seconds
//Default : 86400;
$gpr->maxCacheAge = 86400;

//Enable cache support
//if true, cache option is enabled
//Default : false
$gpr->useCache = false;

//Turn debugging on
//Default : false;
$gpr->debug = true;


/********************************************
*
* Query now
*
********************************************/
echo "PageRank : " .$gpr->GetPR("http://www.mrdbs.com/") ."\n";


/********************************************
*
* Debug query
*
********************************************/
echo "<pre>";
print_r($gpr->debugResult);
echo
"</pre>";

?>


Details

/********************************************************************** GooglePR -- Calculates the Google PageRank of a specified URL Authors : Emre Odabas (emre [at] golge [dot] net) Version : 2.0 Description What is Google PageRank? PageRank is a family of algorithms for assigning numerical weightings to hyperlinked documents (or web pages) indexed by a search engine. Its properties are much discussed by search engine optimization (SEO) experts. The PageRank system is used by the popular search engine Google to help determine a page's relevance or importance. As Google puts it: > PageRank relies on the uniquely democratic nature of the web by > using its vast link structure as an indicator of an individual > page's value. Google interprets a link from page A to page B as > a vote, by page A, for page B. But Google looks at more than the > sheer volume of votes, or links a page receives; it also analyzes > the page that casts the vote. Votes cast by pages that are > themselves "important" weigh more heavily and help to make other > pages "important." For more info: http://www.google.com/corporate/tech.html http://en.wikipedia.org/wiki/PageRank http://www.google.com/webmasters/4.html This class will calculate and return the Google PageRank of the specified input URL as integer. Class was build based on Raistlin Majere's google_pagerank function Change Log: 2008-01-24 * Hash calculation functions updated because of miscalculation based on php versions. (algorithm updated based on a anonymous source code which supposed to be found at http://pagerank.gamesaga.net but not exists any more.) 2005-12-07 * Small bug removed (dies when caching disabled) 2005-11-24 * Added user-agent support * Class selects random google hostnames in order to prevent abuse. (You may define extra google hostnames) * Class now first tries cURL, fsockopen() and file_get_contents() to connect google servers. * Added caching option to class. Results now can be cached to flat files in order to prevent abuse and increase performance. * Cache files are stored in seperate directories for performance issues. 2005-11-04 * Initial version released Ex: $gpr = new GooglePR(); //$gpr->debug=true; //Uncomment this line to debug query process echo $gpr->GetPR("http://www.progen.com.tr"); //Uncomment following line to view debug results //echo "<pre>";print_r($gpr->debugResult);echo "</pre>"; **********************************************************************/

  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example
Plain text file class.googlepr.php Class Class GooglePR
Plain text file README.txt Doc. Readme first
Plain text file test.php Example Check multiple url's with debug results

 Version Control Unique User Downloads Download Rankings  
 0%
Total:14,564
This week:1
All time:67
This week:560Down
User Ratings User Comments (15)
 All time
Utility:86%StarStarStarStarStar
Consistency:80%StarStarStarStarStar
Documentation:78%StarStarStarStar
Examples:78%StarStarStarStar
Tests:-
Videos:-
Overall:67%StarStarStarStar
Rank:469
 
nice
7 years ago (muabshir)
80%StarStarStarStarStar
Work just like it says it does, which is a wonderful thing is...
13 years ago (Texx Smith)
77%StarStarStarStar
This was very well written, and well documented.
14 years ago (Cameron Allen)
80%StarStarStarStarStar
Excellent
14 years ago (kishore kumar)
80%StarStarStarStarStar
Good to use~~
14 years ago (drinkthere)
80%StarStarStarStarStar
example.
14 years ago (Adrian Ramiro)
62%StarStarStarStar
A very useful class.
14 years ago (Wolfgang Stemmer)
77%StarStarStarStar
Multi input post displays bad data, not sure if it is script ...
15 years ago (C)
67%StarStarStarStar
i wil use this tool Thx very much for it
15 years ago (lucicatalin catalin)
80%StarStarStarStarStar
Worked perfectly the minute I got it downloaded
15 years ago (George Fisher)
80%StarStarStarStarStar
This script doesn't work! Even the examples provided (inc goo...
16 years ago (Charles Green)
10%Star
(see remark on forum)
16 years ago (juust out)
80%StarStarStarStarStar
I have only one problem with this script.
16 years ago (Catalin Dordea)
70%StarStarStarStar
Unable to get this working I receive constant pageranks of 1 ...
16 years ago (matthew bagley)
60%StarStarStarStar
This class does not work.
16 years ago (Aral Balkan)
15%Star