Поиграть


Фотографии знаменитостей, Герои нашего времени

Как получить ТИЦ и PR средствами php

Code (php)
  1.  
  2.  
  3. function fetch($source, $start, $smlen, $stop, $fail) {
  4. $data = @implode(, @file($source));
  5. $data = strip_tags($data);
  6. $data = strtolower($data);
  7. $data = str_replace("\n", , $data);
  8. $data = str_replace("\r", , $data);
  9. if(substr_count($data, $fail)) {
  10. return 0;
  11. }
  12. else {
  13. $data = substr($data, strpos($data, $start)+$smlen);
  14. $data = substr($data, 0, strpos($data, $stop));
  15. return trim($data);
  16. }
  17. }
  18. function GooglePageRank($url){
  19. $arr = parse_url($url);
  20. $url = $arr[‘host’];
  21. $url="info:".$url; $ch=GoogleCSum($url,0xE6359A60);
  22. $host="toolbarqueries.google.com"; $hostip=gethostbyname($host);
  23. $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";
  24. $query.="Host: $host\r\n"; $rank=-1;
  25. $query.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
  26. $query.="Connection: Close\r\n\r\n";
  27. $fp=fsockopen($hostip,80,$errno,$errstr,30);
  28. if ($fp){
  29. fputs($fp,$query); $data=""; while (!feof($fp)) $data.=fgets($fp,4096); fclose($fp);
  30. $data=explode("\n",$data);
  31. foreach ($data as $line)
  32. if (!is_bool(strpos($line,"Rank_1"))){
  33. $rank=explode(":",trim($line)); $rank=$rank[2]; break;
  34. }
  35. }
  36. return $rank;
  37. }
  38. function GoogleCSum($s,$key){
  39. $v4=$len=strlen($s); $esi=$key; $ebx=$edi=0×9E3779B9; $p=0;
  40. if ($len>=12)
  41. for($i=0;$i
  42. [Error: Irreparable invalid markup (‘<floor($len/12);$i++){>’) in entry. Owner must fix manually. Raw contents below.]
  43.  
  44. Некоторое время назад потребовалось узнавать эти параметры для нескольких сайтов, достаточно часто и удобно. Порылся в интернете и нашёл два скрипта.
  45. <lj-cut rext="код скриптов под катом">
  46. ДЛЯ ПОЛУЧЕНИЯ PR
  47. function fetch($source, $start, $smlen, $stop, $fail) {
  48. $data = @implode(, @file($source));
  49. $data = strip_tags($data);
  50. $data = strtolower($data);
  51. $data = str_replace("\n", , $data);
  52. $data = str_replace("\r", , $data);
  53. if(substr_count($data, $fail)) {
  54. return 0;
  55. }
  56. else {
  57. $data = substr($data, strpos($data, $start)+$smlen);
  58. $data = substr($data, 0, strpos($data, $stop));
  59. return trim($data);
  60. }
  61. }
  62. function GooglePageRank($url){
  63. $arr = parse_url($url);
  64. $url = $arr[‘host’];
  65. $url="info:".$url; $ch=GoogleCSum($url,0xE6359A60);
  66. $host="toolbarqueries.google.com"; $hostip=gethostbyname($host);
  67. $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";
  68. $query.="Host: $host\r\n"; $rank=-1;
  69. $query.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
  70. $query.="Connection: Close\r\n\r\n";
  71. $fp=fsockopen($hostip,80,$errno,$errstr,30);
  72. if ($fp){
  73. fputs($fp,$query); $data=""; while (!feof($fp)) $data.=fgets($fp,4096); fclose($fp);
  74. $data=explode("\n",$data);
  75. foreach ($data as $line)
  76. if (!is_bool(strpos($line,"Rank_1"))){
  77. $rank=explode(":",trim($line)); $rank=$rank[2]; break;
  78. }
  79. }
  80. return $rank;
  81. }
  82. function GoogleCSum($s,$key){
  83. $v4=$len=strlen($s); $esi=$key; $ebx=$edi=0×9E3779B9; $p=0;
  84. if ($len>=12)
  85. for($i=0;$i<floor($len/12);$i++){
  86. $edi=unsign($edi+ord($s[$p+4])+(ord($s[$p+5]) << 8)+(ord($s[$p+6]) << 16)+(ord($s[$p+7]) << 24));
  87. $esi=unsign($esi+ord($s[$p+8])+(ord($s[$p+9]) << 8)+(ord($s[$p+10]) << 16)+(ord($s[$p+11]) << 24));
  88. $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));
  89. $edi=unsign(($edi-$esi-$edx)^($edx << 8));
  90. $esi=unsign(($esi-$edx-$edi)^shr($edi,13));
  91. $edx=unsign(($edx-$edi-$esi)^shr($esi,12));
  92. $edi=unsign(($edi-$esi-$edx)^($edx << 16));
  93. $esi=unsign(($esi-$edx-$edi)^shr($edi,5));
  94. $edx=unsign(($edx-$edi-$esi)^shr($esi,3)); $ebx=$edx;
  95. $edi=unsign(($edi-$esi-$ebx)^($ebx << 10));
  96. $esi=unsign(($esi-$ebx-$edi)^shr($edi,15));
  97. $v4-=12; $p+=12;
  98. }
  99. $esi=unsign($esi+$len);
  100. if ($v4>=11) $esi=unsign($esi+(ord($s[$p+10]) << 24));
  101. if ($v4>=10) $esi=unsign($esi+(ord($s[$p+9]) << 16));
  102. if ($v4>=9) $esi=unsign($esi+(ord($s[$p+8]) << 8));
  103. 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));
  104. else
  105. { if ($v4>=7) $edi=unsign($edi+(ord($s[$p+6]) << 16));
  106. if ($v4>=6) $edi=unsign($edi+(ord($s[$p+5]) << 8));
  107. if ($v4>=5) $edi=unsign($edi+ord($s[$p+4])); }
  108. 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));
  109. else
  110. { if ($v4>=3) $ebx=unsign($ebx+(ord($s[$p+2]) << 16));
  111. if ($v4>=2) $ebx=unsign($ebx+(ord($s[$p+1]) << 8));
  112. if ($v4>=1) $ebx=unsign($ebx+ord($s[$p+0])); }
  113. $ebx=unsign(($ebx-$edi-$esi)^shr($esi,13));
  114. $edi=unsign(($edi-$esi-$ebx)^($ebx << 8));
  115. $esi=unsign(($esi-$ebx-$edi)^shr($edi,13));
  116. $ebx=unsign(($ebx-$edi-$esi)^shr($esi,12));
  117. $edi=unsign(($edi-$esi-$ebx)^($ebx << 16));
  118. $esi=unsign(($esi-$ebx-$edi)^shr($edi,5));
  119. $ebx=unsign(($ebx-$edi-$esi)^shr($esi,3));
  120. $edi=unsign(($edi-$esi-$ebx)^($ebx << 10));
  121. $esi=unsign(($esi-$ebx-$edi)^shr($edi,15)); return $esi;
  122. }
  123. function shr($x,$y) {
  124. $x=unsign($x);
  125. for($i=0;$i<$y;$i++) $x=floor($x/2); return $x;
  126. }
  127. function unsign($l) {
  128. $l=intval($l);
  129. if ($l>=0){
  130. return $l;
  131. }
  132. else{
  133. return 4294967296+$l;
  134. }
  135. }
  136.  
  137.  
  138. if( $website ){
  139. if( !strstr($website,"http://") && !strstr($website,"https://") ){
  140. $website = "http://".$website;
  141. }
  142. $pr = GooglePageRank($website);
  143. $indexed = $indexedpages[google][0];
  144. $links = $linkedpages[google][0];
  145. $data = array();
  146. $target = trim(eregi_replace(‘http://’, , $website));
  147. // checking Google
  148. $source = ‘http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=link%3A’.$target;
  149. $data[‘Google’] = array(fetch($source, ‘of about’, 9, ‘linking’, ‘did not match any documents’), $source);
  150. //print_r ($data[’Google’]);
  151. }
  152.  
  153. ДЛЯ ПОЛУЧЕНИЯ тИЦ
  154. $content = file_get_contents(‘http://bar-navig.yandex.ru/u?ver=2&show=32&url=’.$url.);
  155. preg_match("/value=\"(.\d*)\"/", $content, $match);
  156. $cy=$match[1];
  157.  
  158.  

+1+2+3+4+5 (4 голосов, в среднем: 3 из 5)
Загрузка... Загрузка...

Оставьте комментарий

Блог разработчика / Посетите: Подмосковье - топографические карты - Turmaps.net
открыть фирму - юрист
поможем деньгами: ипотека
Жми! база отдыха Воронеж - быстро