z4 elite Webmaster Place     域名: http://www.z4.cn
关于网页制作、网站建设、网络开发技术、网络营销与网站推广的交流论坛,有关、php、html、asp等相关内容.legal advice, Chinese Cooking, Cooking, culture, credit card services, cread card, accept credit cards, VISA, MasterCard, American Express, Discover
z4 站长技术交流论坛
z4 站长技术交流论坛 : Powered by vBulletin version 2.3.10z4 站长技术交流论坛 > 技术专栏 > PHP 编程 > [PHPS] The Google Pagerank Checksum Calculator
 上一主题   下一主题
作者
内容 - 发表新主题  回复主题
转载
超级版主
ID: 12


注册日期: Oct 2003
日均发贴: 1.97
发贴总数: 4931
来  自: 中心

Post [PHPS] The Google Pagerank Checksum Calculator
1DEMO:
http://alex.vort-x.net/google/
Source:
PHP:
  1. <?php
  2. /*
  3.     This code is released unto the public domain
  4. */
  5. header("Content-Type: text/plain; charset=utf-8");
  6. define('GOOGLE_MAGIC', 0xE6359A60);
  7. //unsigned shift right
  8. function zeroFill($a, $b)
  9. {
  10.     $z = hexdec(80000000);
  11.         if ($z & $a)
  12.         {
  13.             $a = ($a>>1);
  14.             $a &= (~$z);
  15.             $a |= 0x40000000;
  16.             $a = ($a>>($b-1));
  17.         }
  18.         else
  19.         {
  20.             $a = ($a>>$b);
  21.         }
  22.         return $a;
  23. } 
  24. function mix($a,$b,$c) {
  25.   $a -= $b; $a -= $c; $a ^= (zeroFill($c,13)); 
  26.   $b -= $c; $b -= $a; $b ^= ($a<<8); 
  27.   $c -= $a; $c -= $b; $c ^= (zeroFill($b,13));
  28.   $a -= $b; $a -= $c; $a ^= (zeroFill($c,12));
  29.   $b -= $c; $b -= $a; $b ^= ($a<<16);
  30.   $c -= $a; $c -= $b; $c ^= (zeroFill($b,5)); 
  31.   $a -= $b; $a -= $c; $a ^= (zeroFill($c,3));  
  32.   $b -= $c; $b -= $a; $b ^= ($a<<10); 
  33.   $c -= $a; $c -= $b; $c ^= (zeroFill($b,15));
  34.   
  35.   return array($a,$b,$c);
  36. }
  37. function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
  38.     if(is_null($length)) {
  39.         $length = sizeof($url);
  40.     }
  41.     $a = $b = 0x9E3779B9;
  42.     $c = $init;
  43.     $k = 0;
  44.     $len = $length;
  45.     while($len >= 12) {
  46.         $a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
  47.         $b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
  48.         $c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
  49.         $mix = mix($a,$b,$c);
  50.         $a = $mix[0]; $b = $mix[1]; $c = $mix[2];
  51.         $k += 12; 
  52.         $len -= 12;
  53.     }
  54.     $c += $length;
  55.     switch($len)              /* all the case statements fall through */
  56.     {
  57.         case 11: $c+=($url[$k+10]<<24);
  58.         case 10: $c+=($url[$k+9]<<16);
  59.         case 9 : $c+=($url[$k+8]<<8);
  60.           /* the first byte of c is reserved for the length */
  61.         case 8 : $b+=($url[$k+7]<<24);
  62.         case 7 : $b+=($url[$k+6]<<16);
  63.         case 6 : $b+=($url[$k+5]<<8);
  64.         case 5 : $b+=($url[$k+4]);
  65.         case 4 : $a+=($url[$k+3]<<24);
  66.         case 3 : $a+=($url[$k+2]<<16);
  67.         case 2 : $a+=($url[$k+1]<<8);
  68.         case 1 : $a+=($url[$k+0]);
  69.          /* case 0: nothing left to add */
  70.     }
  71.     $mix = mix($a,$b,$c);
  72.     /*-------------------------------------------- report the result */
  73.     return $mix[2];
  74. }
  75. //converts a string into an array of integers containing the numeric value of the char
  76. function strord($string) {
  77.     for($i=0;$i<strlen($string);$i++) {
  78.         $result[$i] = ord($string{$i});
  79.     }
  80.     return $result;
  81. }
  82. // http://www.example.com/ - Checksum: 6540747202
  83. $url = 'info:'.$_GET['url'];
  84. $ch = GoogleCH(strord($url));
  85. $url='info:'.urlencode($_GET['url']);
  86. $curl = curl_init("http://www.google.com/search?client=navclient-auto&ch=6$ch&ie=UTF-8&oe=UTF-8&features=Rank&q=$url");
  87. curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; GoogleToolbar 2.0.110-big; Windows 2000 5.0)");
  88. curl_exec($curl);
  89. ?>


Format:
http://www.google.com/search?client=navclient-auto&ch=63860912239&features=Rank&q=info:http://bbs.z4.cn

Related link:
http://www.mobileread.com/forums/showthread.php?threadid=1670
short :http://alex.vort-x.net/google/googlehash-source.php
readable :http://alex.vort-x.net/google/googlehash-readable-source.php
http://forums.seochat.com/t12316/s.html
http://www.top25web.com/pagerank.php
http://www.abakus-internet-marketing.de/rreports/seotest.htm
http://www.zenitram.th4y.com/pagerank/?url=bbs.z4.cn
http://cgi.ebay.com/ws/eBayISAPI.dl...ssPageName=WDVW
also:
http://pagerank-checksum.homelinux.com/

http://www.zenitram.th4y.com/pagerank/?url=bbs.z4.cn
Source:
PHP:
  1. <?php
  2. // Google PageRank Calculator function by ZeNiTRaM - version 0.1
  3. // Licensed under the GPL License
  4. // eMail me at zenitram [AT] dubmail.net
  5. // Uses code from The Google Checksum Calculator, by Alex Stapleton, Andy Doctorow, Vijay "Cyberax" Bhatter, and a few others, licensed under the public domain (http://www.mobileread.com/forums/showpost.php?p=7769&postcount=87) and XMLize.php by Hans Anderson (http://www.hansanderson.com/php/xml/).
  6. // Use: $pagerank = GetPagerank("http://www.google.es");
  7. // GetPagerank returns a STRING with the Pagerank number directly from Google
  8. //    S    P    A    N    I    S    H-----------------------------------------------------------------------------------
  9. // Calculadora Google Pagerank por ZeNiTRaM - version 0.1
  10. // Licenciado bajo la licencia GPL.
  11. // Contacta conmigo en zenitram [AT] dubmail.net
  12. // Usa codigo de The Google Checksum Calculator, por Alex Stapleton, Andy Doctorow, Vijay "Cyberax" Bhatter, y unos cuantos otros mas, licenciado bajo dominio publico (http://www.mobileread.com/forums/showpost.php?p=7769&postcount=87) y XMLize.php por Hans Anderson (http://www.hansanderson.com/php/xml/).
  13. /*
  14. Changelog
  15. 0.1:    Started counting versions and tidied all the code. Maybe I will add some new functions to get more information from Google. 
  16.     He empezado a contar versiones y limpiado un poco todo el codigo. Quizas a&ntilde;ada nuevas funciones para conseguir mas informacion de Google.
  17. */
  18. // Function GetPagerank
  19. function GetPagerank($urlo) {
  20. define('GOOGLE_MAGIC', 0xE6359A60);
  21. $url = 'info:'.$urlo; 
  22. $ch = GoogleCH(strord($url)); 
  23. $chf = "6$ch"; 
  24. $file = file("http://www.google.com/search?client=navclient-auto&ch=$chf&q=$url");
  25. $file_str = implode("", $file);
  26. $xml = xmlize($file_str); 
  27. $pr = $xml["GSP"]["#"]["RES"][0]["#"]["R"][0]["#"]["RK"][0]["#"];
  28. if(!$pr) $pr = 0;
  29. return $pr;
  30. }
  31. //Starts code from XMLize.php
  32. function xmlize($data, $WHITE=1) {
  33.     $data = trim($data);
  34.     $vals = $index = $array = array();
  35.     $parser = xml_parser_create();
  36.     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
  37.     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $WHITE);
  38.     if ( !xml_parse_into_struct($parser, $data, $vals, $index) )
  39.     {
  40.     die(sprintf("XML error: %s at line %d",
  41.                     xml_error_string(xml_get_error_code($parser)),
  42.                     xml_get_current_line_number($parser)));
  43.     }
  44.     xml_parser_free($parser);
  45.     $i = 0; 
  46.     $tagname = $vals[$i]['tag'];
  47.     if ( isset ($vals[$i]['attributes'] ) )
  48.     {
  49.         $array[$tagname]['@'] = $vals[$i]['attributes'];
  50.     } else {
  51.         $array[$tagname]['@'] = array();
  52.     }
  53.     $array[$tagname]["#"] = xml_depth($vals, $i);
  54.     return $array;
  55. }
  56. /* 
  57.  *
  58.  * You don't need to do anything with this function, it's called by
  59.  * xmlize.  It's a recursive function, calling itself as it goes deeper
  60.  * into the xml levels.  If you make any improvements, please let me know.
  61.  *
  62.  *
  63.  */
  64. function xml_depth($vals, &$i) { 
  65.     $children = array(); 
  66.     if ( isset($vals[$i]['value']) )
  67.     {
  68.         array_push($children, $vals[$i]['value']);
  69.     }
  70.     while (++$i < count($vals)) { 
  71.         switch ($vals[$i]['type']) { 
  72.            case 'open': 
  73.                 if ( isset ( $vals[$i]['tag'] ) )
  74.                 {
  75.                     $tagname = $vals[$i]['tag'];
  76.                 } else {
  77.                     $tagname = '';
  78.                 }
  79.                 if ( isset ( $children[$tagname] ) )
  80.                 {
  81.                     $size = sizeof($children[$tagname]);
  82.                 } else {
  83.                     $size = 0;
  84.                 }
  85.                 if ( isset ( $vals[$i]['attributes'] ) ) {
  86.                     $children[$tagname][$size]['@'] = $vals[$i]["attributes"];
  87.                 }
  88.                 $children[$tagname][$size]['#'] = xml_depth($vals, $i);
  89.             break; 
  90.             case 'cdata':
  91.                 array_push($children, $vals[$i]['value']); 
  92.             break; 
  93.             case 'complete': 
  94.                 $tagname = $vals[$i]['tag'];
  95.                 if( isset ($children[$tagname]) )
  96.                 {
  97.                     $size = sizeof($children[$tagname]);
  98.                 } else {
  99.                     $size = 0;
  100.                 }
  101.                 if( isset ( $vals[$i]['value'] ) )
  102.                 {
  103.                     $children[$tagname][$size]["#"] = $vals[$i]['value'];
  104.                 } else {
  105.                     $children[$tagname][$size]["#"] = '';
  106.                 }
  107.                 if ( isset ($vals[$i]['attributes']) ) {
  108.                     $children[$tagname][$size]['@']
  109.                                              = $vals[$i]['attributes'];
  110.                 }            
  111.             break; 
  112.             case 'close':
  113.                 return $children; 
  114.             break;
  115.         } 
  116.     } 
  117.     return $children;
  118. }
  119. /* function by acebone@f2s.com, a HUGE help!
  120.  *
  121.  * this helps you understand the structure of the array xmlize() outputs
  122.  *
  123.  * usage:
  124.  * traverse_xmlize($xml, 'xml_');
  125.  * print '<pre>' . implode("", $traverse_array . '</pre>';
  126.  *
  127.  *
  128.  */ 
  129. function traverse_xmlize($array, $arrName = "array", $level = 0) {
  130.     foreach($array as $key=>$val)
  131.     {
  132.         if ( is_array($val) )
  133.         {
  134.             traverse_xmlize($val, $arrName . "[" . $key . "]", $level + 1);
  135.         } else {
  136.             $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n";
  137.         }
  138.     }
  139.     return 1;
  140. }
  141. //Ends code from XMLize.php
  142. //Starts code from The Google Checksum Calculator
  143. //unsigned shift right
  144. function zeroFill($a, $b)
  145. {
  146.     $z = hexdec(80000000);
  147.         if ($z & $a)
  148.         {
  149.             $a = ($a>>1);
  150.             $a &= (~$z);
  151.             $a |= 0x40000000;
  152.             $a = ($a>>($b-1));
  153.         }
  154.         else
  155.         {
  156.             $a = ($a>>$b);
  157.         }
  158.         return $a;
  159. }
  160. function mix($a,$b,$c) {
  161.   $a -= $b; $a -= $c; $a ^= (zeroFill($c,13));
  162.   $b -= $c; $b -= $a; $b ^= ($a<<8);
  163.   $c -= $a; $c -= $b; $c ^= (zeroFill($b,13));
  164.   $a -= $b; $a -= $c; $a ^= (zeroFill($c,12));
  165.   $b -= $c; $b -= $a; $b ^= ($a<<16);
  166.   $c -= $a; $c -= $b; $c ^= (zeroFill($b,5));
  167.   $a -= $b; $a -= $c; $a ^= (zeroFill($c,3));  
  168.   $b -= $c; $b -= $a; $b ^= ($a<<10);
  169.   $c -= $a; $c -= $b; $c ^= (zeroFill($b,15));
  170.   
  171.   return array($a,$b,$c);
  172. }
  173. function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
  174.     if(is_null($length)) {
  175.         $length = sizeof($url);
  176.     }
  177.     $a = $b = 0x9E3779B9;
  178.     $c = $init;
  179.     $k = 0;
  180.     $len = $length;
  181.     while($len >= 12) {
  182.         $a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
  183.         $b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
  184.         $c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
  185.         $mix = mix($a,$b,$c);
  186.         $a = $mix[0]; $b = $mix[1]; $c = $mix[2];
  187.         $k += 12;
  188.         $len -= 12;
  189.     }
  190.     $c += $length;
  191.     switch($len)              /* all the case statements fall through */
  192.     {
  193.         case 11: $c+=($url[$k+10]<<24);
  194.         case 10: $c+=($url[$k+9]<<16);
  195.         case 9 : $c+=($url[$k+8]<<8);
  196.           /* the first byte of c is reserved for the length */
  197.         case 8 : $b+=($url[$k+7]<<24);
  198.         case 7 : $b+=($url[$k+6]<<16);
  199.         case 6 : $b+=($url[$k+5]<<8);
  200.         case 5 : $b+=($url[$k+4]);
  201.         case 4 : $a+=($url[$k+3]<<24);
  202.         case 3 : $a+=($url[$k+2]<<16);
  203.         case 2 : $a+=($url[$k+1]<<8);
  204.         case 1 : $a+=($url[$k+0]);
  205.          /* case 0: nothing left to add */
  206.     }
  207.     $mix = mix($a,$b,$c);
  208.     /*-------------------------------------------- report the result */
  209.     return $mix[2];
  210. }
  211. //converts a string into an array of integers containing the numeric value of the char
  212. function strord($string) {
  213.     for($i=0;$i<strlen($string);$i++) {
  214.         $result[$i] = ord($string{$i});
  215.     }
  216.     return $result;
  217. }
  218. //End code from The Google Checksum Calculator
  219. ?>


http://www.seroundtable.com/
http://www.seobook.com/
# 请多加利用『搜寻』功能再发问。
# 请确实选择您的话题,注明您的目的是:【搜寻】、【分享】、【闲聊】 ...。
# 请确认您发表的位置,切勿一文多发或是与分类不符。
# 对於您所发表的文章内容本站及相关站务人员一律不负责任何後果。
# 欢迎大家一起在此成长交流心得 ... ...,
# 祝各位 网上愉快 学有所成。

别吝啬您的发言权利,一篇文章、一段感言都是造就分享与知识的原动力

Useful links: Your vB GZIP status | Your vB Apache/ PHP Headers | Reduce Bandwidth
vB Free Email Domain Ban List | vB Color Scheme Machine

帮你背单词:【 向版主报告此贴 转载 的IP地址已记录 回到顶端

Old Post 2004-07-06 21:42
离线 点击这里查看 转载 的个人资料 点击这里给 转载 发送一条短消息 访问 转载 的主页! 查找更多关于 转载 的帖子 添加 转载 至你的好友列表 编辑 引用
转载
超级版主
ID: 12


注册日期: Oct 2003
日均发贴: 1.97
发贴总数: 4931
来  自: 中心

PHP Google PageRank Retriever
2

附件(.zip): pagerank.zip 2.7kb 已被下载 213 次。

帮你背单词:【 向版主报告此贴 转载 的IP地址已记录 回到顶端

Old Post 2005-01-20 14:36
离线 点击这里查看 转载 的个人资料 点击这里给 转载 发送一条短消息 访问 转载 的主页! 查找更多关于 转载 的帖子 添加 转载 至你的好友列表 编辑 引用
本站栏目: PHP 编程
China tsgm
新手上路
ID: 1102


注册日期: Sep 2005
日均发贴: 0.00
发贴总数: 1
来  自:

3该脚本在LINUX平台下运行有问题,哪位碰到过?

帮你背单词:【 向版主报告此贴 tsgm 的IP地址已记录 回到顶端

Old Post 2005-09-15 04:05
离线 点击这里查看 tsgm 的个人资料 点击这里给 tsgm 发送一条短消息 查找更多关于 tsgm 的帖子 添加 tsgm 至你的好友列表 编辑 引用
本站栏目: 获得你自己的像 me@z4x.com 的邮箱           登录z4x.com 邮箱
转载
超级版主
ID: 12


注册日期: Oct 2003
日均发贴: 1.97
发贴总数: 4931
来  自: 中心

Linkchecker 1.1
4I found this php file in my hard drive, I check and it works good
PHP:
  1. <?
  2. // Copyright 2005 Carmosa - All rights reserved
  3. // Linkchecker 1.1
  4. // Do not distribute
  5. // http://www.z4.cn
  6. // Read the license agreement that accompanies this script.
  7. ?>
  8. <style>
  9. *    {    text-decoration:none    }
  10. a {font-family:Verdana; font-size:11px; color:#0000FF; text-decoration:none}
  11. p {font-family:verdana; font-size:11px; color:black; text-decoration:none}
  12. td {font-family:verdana; font-size:11px; color:black;}
  13. tr {font-family:verdana; font-size:11px; color:black;}
  14. body {font-family:verdana; font-size:11px; color:black;}
  15. h1 {font-family:verdana; font-size:18px; color:black; font-weight:bold;}
  16. h2 {font-family:verdana; font-size:15px; color:black; font-weight:bold;}
  17. </style>
  18. <center><h1>Google Page Rank</h1>
  19. <form method="POST">Enter Web Site: <input name='url' value='<?=$_REQUEST['url']; ?>' size="20" /><input type="submit" value="Get My Site Rank" /></form>
  20. <hr />
  21. <?
  22. $website = $_REQUEST['url'];
  23. if( $website ){
  24.     if( !strstr($website,"http://") && !strstr($website,"https://") ){
  25.         $website = "http://".$website;
  26.     }
  27.     $linkedpages = linkcheck($website,'google');
  28.     $indexedpages = GoogleLinks($website);
  29.     $pr = GooglePageRank($website);
  30.     $indexed = $indexedpages[google][0];
  31.     $links = $linkedpages[google][0];
  32.     $data = array();
  33.     $target = trim(eregi_replace('http://', '', $website));
  34.     // checking Google
  35.     $source = 'http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=link%3A'.$target;
  36.     $data['Google'] = array(fetch($source, 'of about', 9, 'linking', 'did not match any documents'), $source);
  37.     // checking MSN Search
  38.     $source = 'http://search.msn.com/results.aspx?FORM=MSNH&srch_type=0&q=link%3A'.$target;
  39.     $data['MSN Search'] = array(fetch($source, 'web results1-', 18, 'containing', "couldn't find any sites containing"), $source);
  40.     // checking Yahoo!
  41.     $source = 'http://search.yahoo.com/search?p=linkdomain%3A'.$target.'&sm=Yahoo%21+Search&fr=FP-tab-web-t&toggle=1';
  42.     $data['Yahoo!'] = array(fetch($source, 'of about', 9, 'for', "we didn't find any web pages"), $source);
  43.     // checking AlltheWeb
  44.     $source = 'http://www.alltheweb.com/search?cat=web&cs=utf8&q=link%3A'.$target.'&rys=0&_sb_lang=pref';
  45.     $data['AlltheWeb'] = array(fetch($source, 'audio1 -', 14, 'results', "no web pagesfound that match your query"), $source);
  46.     // checking AltaVista
  47.     $source = 'http://www.altavista.com/web/results?itag=wrx&q=linkdomain%3A'.$target.'&kgs=1&kls=0';
  48.     $data['AltaVista'] = array(fetch($source, 'altavista found', 15, 'results', "we found 0 results"), $source);
  49. ?>
  50.     <table width='400' border='0' cellpadding='5' cellspacing='0'>
  51.         <tr>
  52.             <td align='left' colspan='2'><b>Retrieving info for <?=$website?>...</b></td>
  53.         </tr>
  54.         <tr>
  55.             <td><strong>Website</strong></td><td><a href="<?=$website?>"><?=$website?></a></td>
  56.         </tr>
  57.         <tr>
  58.             <td><strong>Page Rank</strong></td><td><?=$pr?> / 10</td>
  59.         </tr>
  60.         <tr>
  61.             <td><strong>Indexed Pages</strong></td><td><a href="<?=$indexedpages[google][1]?>"><?=$indexed?></a></td>
  62.         </tr>
  63.         <tr>
  64.             <td><strong>BackLinks</strong></td><td><a href="<?=$linkedpages[google][1]?>"><?=$links?></a></td>
  65.         </tr>
  66.     </table>
  67.     <hr>
  68.     <table width='400' border='0' cellpadding='5' cellspacing='0'>
  69.         <tr>
  70.             <td align='center' colspan='2'><h2>Link Popularity Report</h2></td>
  71.         </tr>
  72.         <tr>
  73.             <td><strong>Search Engine</strong></td><td align='right'><strong>Indexed Links</strong></td>
  74.         </tr>
  75.         <?
  76.         foreach($data as $engine => $result) {
  77.         ?>
  78.         <tr>
  79.             <td><a href='http://z4.cc?url*<? echo $result[1]; ?>' target='_blank'><? echo $engine; ?></a></td>
  80.             <td align='right'>
  81.             <?
  82.             if($result[0])
  83.                 echo $result[0];
  84.             else
  85.                 echo 'Not Available';
  86.             ?>
  87.             </td>
  88.         </tr>
  89.         <?
  90.         $total += ereg_replace("[[:punct:]]", '', $result[0]);
  91.         }
  92.         ?>
  93.         <tr>
  94.             <td><strong>Total</strong></td>
  95.             <td align='right'><strong><? echo $total; ?></strong></td>
  96.         </tr>
  97.     </table>
  98. </center>
  99. <?
  100. }
  101. function fetch($source, $start, $smlen, $stop, $fail) {
  102.     $data = @implode('', @file($source));
  103.     $data = strip_tags($data);
  104.     $data = strtolower($data);
  105.     $data = str_replace("\n", '', $data);
  106.     $data = str_replace("\r", '', $data);
  107.     if(substr_count($data, $fail)) {
  108.         return 0;
  109.     } else {
  110.         $data = substr($data, strpos($data, $start)+$smlen);
  111.         $data = substr($data, 0, strpos($data, $stop));
  112.         return trim($data);
  113.     }
  114. }
  115. function linkcheck($url, $engine) {
  116.     global $total;
  117.     $arr = parse_url($url);
  118.     $url = $arr['host'];
  119.     $path = "http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=link%3A".$url;
  120.     if(!file_exists($path)) {
  121.         $data = strtolower(strip_tags(implode("", file($path))));
  122.         $data = substr($data, strpos($data, "of about")+9, strlen($data));
  123.         $data = substr($data, 0, strpos($data, " "));
  124.         if(eregi("[[:alpha:]]", $data)) {
  125.             $results[$engine] = array('0', $path);
  126.         } else {
  127.             $results[$engine] = array($data, $path);
  128.             $total+=str_replace(',', '', $data);
  129.         }
  130.     } else {
  131.         $results[$engine] = array('n/a', $path);
  132.     }
  133.     return $results;
  134. }
  135. function GoogleLinks($url){
  136.     $arr = parse_url($url);
  137.     $url = $arr['host'];
  138.     $engine = 'google';
  139.     $path = 'http://www.google.com/search?q=inurl:'.$url.'&hl=en&lr=&ie=UTF-8&filter=0';
  140.     if(!file_exists($path)) {
  141.         $data = str_replace('&nbsp;', ' ', strtolower(strip_tags(@implode('', @file($path)))));
  142.         if(!strpos($data, 'did not match any documents')) {
  143.             $data = substr($data, strpos($data, 'web results')+12, strlen($data));
  144.             $data = trim(substr($data, 0, strpos($data, 'for'))); //echo $data; // TEST
  145.             $data = explode(' ', $data);
  146.             $data = $data[(count($data)-1)];
  147.             $results[$engine] = array($data, $path);
  148.             $total+=str_replace(',', '', $data);
  149.         } else {
  150.             $results[$engine] = array('0', $path);
  151.         }
  152.     } else {
  153.         $results[$engine] = array('n/a', $path);
  154.     }
  155.     return $results;
  156. }
  157. function GooglePageRank($url){
  158.     $arr = parse_url($url);
  159.     $url = $arr['host'];
  160.     $url="info:".$url; $ch=GoogleCSum($url,0xE6359A60);
  161.     $host="toolbarqueries.google.com"; $hostip=gethostbyname($host);
  162.     $query ="GET /search?client=navclient-auto&ch=6".$ch."&ie=UTF-8&oe=UTF-8&features=Rank&q=".rawurlencode($url)." HTTP/1.0\r\n";
  163.     $query.="Host: $host\r\n"; $rank=-1;
  164.     $query.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
  165.     $query.="Connection: Close\r\n\r\n";
  166.     $fp=fsockopen($hostip,80,$errno,$errstr,30);
  167.     if ($fp)
  168.     { fputs($fp,$query); $data=""; while (!feof($fp)) $data.=fgets($fp,4096); fclose($fp);
  169.     $data=explode("\n",$data);
  170.     foreach ($data as $line)
  171.     if (!is_bool(strpos($line,"Rank_1")))
  172.     { $rank=explode(":",trim($line)); $rank=$rank[2]; break; } }
  173.     return $rank;
  174. }
  175. function GoogleCSum($s,$key){
  176.     $v4=$len=strlen($s); $esi=$key; $ebx=$edi=0x9E3779B9; $p=0;
  177.     if ($len>=12)
  178.     for($i=0;$i<floor($len/12);$i++)
  179.     { $edi=unsign($edi+ord($s[$p+4])+(ord($s[$p+5]) << 8)+(ord($s[$p+6]) << 16)+(ord($s[$p+7]) << 24));
  180.     $esi=unsign($esi+ord($s[$p+8])+(ord($s[$p+9]) << 8)+(ord($s[$p+10]) << 16)+(ord($s[$p+11]) << 24));
  181.     $edx=unsign(($ebx+ord($s[$p+0])+(ord($s[$p+1]) << 8)+(ord($s[$p+2]) << 16)+(ord($s[$p+3]) << 24)-$edi-$esi)^shr($esi,13));
  182.     $edi=unsign(($edi-$esi-$edx)^($edx << 8));
  183.     $esi=unsign(($esi-$edx-$edi)^shr($edi,13));
  184.     $edx=unsign(($edx-$edi-$esi)^shr($esi,12));
  185.     $edi=unsign(($edi-$esi-$edx)^($edx << 16));
  186.     $esi=unsign(($esi-$edx-$edi)^shr($edi,5));
  187.     $edx=unsign(($edx-$edi-$esi)^shr($esi,3)); $ebx=$edx;
  188.     $edi=unsign(($edi-$esi-$ebx)^($ebx << 10));
  189.     $esi=unsign(($esi-$ebx-$edi)^shr($edi,15));
  190.     $v4-=12; $p+=12; }
  191.     $esi=unsign($esi+$len);
  192.     if ($v4>=11) $esi=unsign($esi+(ord($s[$p+10]) << 24));
  193.     if ($v4>=10) $esi=unsign($esi+(ord($s[$p+9]) << 16));
  194.     if ($v4>=9) $esi=unsign($esi+(ord($s[$p+8]) << 8));
  195.     if ($v4>=8) $edi=unsign($edi+ord($s[$p+4])+(ord($s[$p+5]) << 8)+(ord($s[$p+6]) << 16)+(ord($s[$p+7]) << 24));
  196.     else
  197.     { if ($v4>=7) $edi=unsign($edi+(ord($s[$p+6]) << 16));
  198.     if ($v4>=6) $edi=unsign($edi+(ord($s[$p+5]) << 8));
  199.     if ($v4>=5) $edi=unsign($edi+ord($s[$p+4])); }
  200.     if ($v4>=4) $ebx=unsign($ebx+ord($s[$p+0])+(ord($s[$p+1]) << 8)+(ord($s[$p+2]) << 16)+(ord($s[$p+3]) << 24));
  201.     else
  202.     { if ($v4>=3) $ebx=unsign($ebx+(ord($s[$p+2]) << 16));
  203.     if ($v4>=2) $ebx=unsign($ebx+(ord($s[$p+1]) << 8));
  204.     if ($v4>=1) $ebx=unsign($ebx+ord($s[$p+0])); }
  205.     $ebx=unsign(($ebx-$edi-$esi)^shr($esi,13));
  206.     $edi=unsign(($edi-$esi-$ebx)^($ebx << 8));
  207.     $esi=unsign(($esi-$ebx-$edi)^shr($edi,13));
  208.     $ebx=unsign(($ebx-$edi-$esi)^shr($esi,12));
  209.     $edi=unsign(($edi-$esi-$ebx)^($ebx << 16));
  210.     $esi=unsign(($esi-$ebx-$edi)^shr($edi,5));
  211.     $ebx=unsign(($ebx-$edi-$esi)^shr($esi,3));
  212.     $edi=unsign(($edi-$esi-$ebx)^($ebx << 10));
  213.     $esi=unsign(($esi-$ebx-$edi)^shr($edi,15)); return $esi;
  214. }
  215. function shr($x,$y) {
  216.     $x=unsign($x);
  217.     for($i=0;$i<$y;$i++) $x=floor($x/2); return $x;
  218. }
  219. function unsign($l) {
  220.     $l=intval($l);
  221.     if ($l>=0){
  222.         return $l;
  223.     }else{
  224.         return 4294967296+$l;
  225.     }
  226. }
  227. ?>

帮你背单词:【 向版主报告此贴 转载 的IP地址已记录 回到顶端

Old Post 2005-11-15 03:17
离线 点击这里查看 转载 的个人资料 点击这里给 转载 发送一条短消息 访问 转载 的主页! 查找更多关于 转载 的帖子 添加 转载 至你的好友列表 编辑 引用
本站栏目: Get your own e-mail such as me@z4x.com here.           Sign In
转载
超级版主
ID: 12


注册日期: Oct 2003
日均发贴: 1.97
发贴总数: 4931
来  自: 中心

Google Checksum 新算法3.0.125.1-big版Toolbar
5
引用: AboutSledge
PHP版本的CH算法,Google Toolbar3.0.125.1-big

这是PHP的,演示

http://www.gamesage.net/pagerank.php

绝对原创,不敢说全球首家获取新版Checksum算法的,也是全球首家 公开Toolbar 3.0.125.1-big Checksum算法的

我用这个还换了一个不限制流量的PHP空间呢,呵呵

PHP:
  1. <?php
  2. /******************************************************************************
  3. Filename    : pagerank.php
  4. Description    : Google PageRank Checksum Algorithm (Toolbar 3.0.125.1-big)
  5. Author           : Jet Marx   <smith at aboutsledge dot com>
  6. License          : UPL
  7. Release Date: 2005-09-13
  8. ******************************************************************************/
  9. function StrOrd($String)
  10. {
  11.         for($i=0;$i<strlen($String);$i++) {
  12.                 $result[$i] = ord ($String{$i});
  13.         }
  14.         return $result;
  15. }
  16. function StrToNum($StrArray,$Checksum,$MagicNum)
  17. {
  18.         $length = sizeof($StrArray);
  19.         for( $i=0; $i<$length; $i++) {
  20.                 $Checksum *= $MagicNum;
  21.                 $Checksum = (int)$Checksum;   //Force to Integer Overflow
  22.                 $Checksum += $StrArray[$i];
  23.                 $Checksum = (int)$Checksum;
  24.         }
  25.         return $Checksum;
  26. }
  27. function Check($String)
  28. {
  29.         $Checksum1 = 0x1505;
  30.         $Checksum2 = 0;
  31.         $StrArray =StrOrd($String);
  32.         $Checksum1 = StrToNum($StrArray,$Checksum1,0x21);
  33.         $Checksum2 = StrToNum($StrArray,&$Checksum2,0x1003F);
  34.         $Checksum1 >>= 2;
  35.         $Checksum1 = ( ($Checksum1>>4) & 0x3FFFFC0 ) | ($Checksum1 & 0x3F);
  36.         $Checksum1 = ( ($Checksum1>>4) & 0x3FFC00 ) | ($Checksum1 & 0x3FF);
  37.         $Checksum1 = ( ($Checksum1>>4) & 0x3C000 ) | ($Checksum1 & 0x3FFF);
  38.         $T1 =  (((($Checksum1&0x3C0)<<4)|($Checksum1 & 0x3C))<<2)|($Checksum2 & 0xF0F );
  39.         $T2 =  (((($Checksum1&0xFFFFC000)<<4)|($Checksum1 & 0x3C00))<<0xA)|($Checksum2 & 0xF0F0000 );
  40.         return $Checksum1 = $T1 | $T2;
  41. }
  42. function CheckMore($Checksum)
  43. {
  44.         $CheckChar = 0;
  45.         $Flag        = 0;
  46.         $CheckStr  = sprintf("%u", $Checksum) ;
  47.         $length    = strlen($CheckStr);
  48.         for( $i=$length-1;  $i>=0;  $i --) {
  49.                 $Re = $CheckStr{$i};
  50.                 if ( 1 == ($Flag%2) ) {
  51.                         $Re += $Re;
  52.                         $Re = (int)($Re/10) + ($Re%10);
  53.                 }
  54.                 $CheckChar = $Re + $CheckChar;
  55.                 $Flag ++;
  56.         }
  57.         return $CheckChar = (10-$CheckChar%10)%10;
  58. }
  59. if ( isset ($_GET['url'])) {
  60.         $Checksum = Check($_GET['url']);
  61.         echo "<a href='http://www.google.com/search?client=navclient-auto&features=Rank:&q=info:";
  62.         echo $_GET['url']."&ch=7".CheckMore($Checksum);
  63.         printf("%u",$Checksum);
  64.         echo "'>Get PageRank</a>";
  65. }else{
  66.         ?>
  67.                 <form action='' method='get' name='pr'>
  68.                         <br />URL:<input name='url' value='http://www.z4.cn' type='text' size=40 />
  69.                     <a href="javascript:void(0);" onclick="pr.submit();">Submit</a>
  70.                 </form>
  71.         <?
  72. }
  73. ?>

来自: 落伍者

帮你背单词:【 向版主报告此贴 转载 的IP地址已记录 回到顶端

Old Post 2006-02-07 00:16
离线 点击这里查看 转载 的个人资料 点击这里给 转载 发送一条短消息 访问 转载 的主页! 查找更多关于 转载 的帖子 添加 转载 至你的好友列表 编辑 引用
转载
超级版主
ID: 12


注册日期: Oct 2003
日均发贴: 1.97
发贴总数: 4931
来  自: 中心

模拟Google ToolBar直接提交PageRank请求
6

帮你背单词:【 向版主报告此贴 转载 的IP地址已记录 回到顶端

信誉主机服务商 WebHostingFly.com
Old Post 2006-02-07 00:29
离线 点击这里查看 转载 的个人资料 点击这里给 转载 发送一条短消息 访问 转载 的主页! 查找更多关于 转载 的帖子 添加 转载 至你的好友列表 编辑 引用
站长资源 Web tools and webmaster resources HitsLink.com
默认使用多伦多时间, 现在时间为10:23发表新主题  回复主题
  上一主题   返回论坛   下一主题
显示可打印版本 |  alt=发送本页面给朋友 将本页推荐给朋友 | 订阅此主题 | 保存该主题为(.txt file)文件下载 下载本主题

论坛跳转:
主题评分:

论坛规定:
你不可以发表新主题
你不可以回复帖子
你不可以上传附件
你不可以编辑自己的帖子
HTML代码禁止
vB 代码允许
表情符号允许
贴图代码[IMG]允许
 

< English(ver) - z4 Blog - 联系我们 - ReDesign - z4 Kit - Google - 百度 - Archive - DMOZ - NeoWin - 站长登陆 - WebMail - Google Group >
收藏此页到365Key

拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论!

Powered by: vB ulletin Version 2.3.10
Copyright ©2000 - 2010,Jel soft Enterpri ses Limited.
z4 elite forum

Clicky