In http://depoch.net/article/html/Article-230.htm see this article, it feels useful, and it is turned here.
The algorithm is derived from the Internet, Greg Shaw is slightly modified, open the socket, simulate Toolbar behavior, and submit a query to www.google.com
Principle introduction:
Many webmasters are very interested in the change of their site in Rank during Google Dance. In addition, many people also want to know their new Panerank. In general, the Google toolbar acquires the PageRank value from the data center specified by the IP recorded by the actual DNS record of www.google.com. So, when Google Dance begins, the toolbar usually displays the old PageRank value. Google submits PageRank to the toolbar with a simple text file. It is passed by XML earlier. It is probably in the form of a text in August 2002. PageRank files can get PR: http://www.google.com/search? Client = navclient-auto & ch = 0123456789 & features = rank & q = info: http://www.domain.com/ In PageRank file Only one line of words, the last part is PageRank value. In order to display the PageRank file in the browser, each of the above URLs is required: 1. "NavClient-Auto" is the value of the parameter "client", Used to identify the toolbar. 2. Submit the URL by parameter "q". 3. The value of the parameter "features" is "rank", indicating a request for a PageRank file. If you ignore this parameter, Googles' servers or files returned to the old XML format. 4. Parameter "CH" transmits a checksum for the URL you want to submit to Google. The checksum may be changed when the version of the Google's toolbar is updated. The Google toolbar requests a PageRank file and can be cached by the IE. So their URLs and checksum can simply look at the internet temporary folder. Know your URL, you can view your PageRank via your browser. Because the PageRank file is cached by the browser and is displayed in a clear text, it will not be cleared once the request is requested. So see the PageRank file in your browser should have no violation of Google's terms. However, you should be cautious, because the toolbar is submitted to Google with their own user agent: mozilla / 4.0 (compatible; googletoolbar 1.1.60-deleon; osse se4.10) 1.1.60-deleon is the version of the toolbar, Of course it may change. OS is your installed operating system. So, if you don't pass a proxy server and the browser ID is not modified, Google recognizes the browser's request. Now let's take a look at how we can get a new PageRank value. Look at the Save of IE, you will notice that the PageRank file is not from www.google.com but from the IP address image 216.239.33.102. In addition, the URL of the PageRank file typically contains a "failedip" parameter, which is set to "216.239.35.102; 1111" (it is still not very clear) (UPSDN Note: It is the IP address of the server that is invalid. Generally, the last request failed server, or the server without updating the index) However, getting new PageRank is simple. Modify the IP address in the URL, which is sent to a data center with a new index. The following describes the behavior of PHP simulation TOOBAR directly acquires the PageRank value: Code:
php // error_reporting (e_all); define ('Google_Magic', 0xE6359A60); // Unsigned Shift Right Function Zerofill ($ A, $ B) {$ z = HEXDEC (800000000); if ($ z & $ a) {$ A = ($ A >> 1); $ A & = (~ $ z); $ A | = 0x40000000; $ A = ($ A >> ($ B-1));} else {$ A = ($ A >> $ b);} Return $ A;} Function Mix ($ A, $ B) {$ A - = $ b; $ a - = $ c; $ a ^ = (Zerofill ($ ZEROFILL) C, 13)); $ b - = $ c; $ b - = $ a; $ b ^ = ($ a << 8); $ c - = $ a; $ c - = $ b; $ c ^ = (Zerofill ($ B, 13)); $ A - = $ b; $ a - = $ c; $ a ^ = (Zerofill ($ C, 12)); $ b - = $ c; $ b - = $ a; $ b ^ = ($ a << 16); $ c - = $ a; $ c - = $ b; $ c ^ = (Zerofill ($ B, 5)); $ a - = $ b; $ a - = $ c; $ a ^ = (Zerofill ($ C, 3)); $ b - = $ c; $ b - = $ a; $ b ^ = ($ a << 10); $ c - = $ a; $ c - = $ b; $ c ^ = (Zerofill ($ B, 15)); Return Array ($ A, $ B, $ C);} Function Googlech ($ URL, $ length = NULL, $ INIT = Google_Magic) {IF (is_null ($ length)) {$ length = sizeof ($ URL);} $ a = $ b = 0x9e3779b9; $ c = $ init; $ k = 0; $ g = $ length; while ($ LEN> = 12) {$ A = ($ URL [$ K 0] ($ URL [$ K 1] << 8) ($ URL [$ K 2] << 16) ($ URL [$ K 3] << 24); $ b = ($ URL [$ K 4] ($ URL [$ K 5] << 8) ($ URL [$ K 6] << 16) ($ URL [$ K 7] << 24)); $ C = ($ URL [$ K 8] ($ URL [$ K 9] << 8) ($ URL [$ K 10] << 16) ($ URL [$ K 11] << 24)); $ MIX = Mix ($ A, $ B, $ C); $ A = $ Mix [0]; $ b = $ Mix [1]; $ c = $ mix [2]; $ k = 12; $ LEN - = 12;} $ C = $ length; switch ($ len) / * all the case statements Fall through * / { Case 11: $ C = ($ URL [$ K 10] << 24); Case 10: $ C =
($ URL [$ K 9] << 16); Case 9: $ C = ($ URL [$ K 8] << 8); / * The first byte of c is reserved for the length * / case 8 : $ B = ($ URL [$ K 7] << 24); Case 7: $ B = ($ URL [$ K 6] << 16); Case 6: $ B = ($ URL [$ K) 5] << 8); Case 5: $ b = ($ URL [$ K 4]); Case 4: $ A = ($ URL [$ K 3] << 24); Case 3: $ A = ($ URL [$ K 2] << 16); Case 2: $ A = ($ URL [$ K 1] << 8); Case 1: $ A = ($ URL [$ K 0] ); / * Case 0: Nothing Left to add * /} $ mix = mix ($ A, $ B, $ C); / * ------------------- ------------------------- Report the result * / return $ mix [2];} // converts a string inn array of integers containing the Numeric Value of the Char Function Strord ($ I = 0; $ I