{"id":45,"date":"2023-06-05T12:56:47","date_gmt":"2023-06-05T04:56:47","guid":{"rendered":"http:\/\/pro369.com\/php\/?p=45"},"modified":"2019-06-27T03:19:00","modified_gmt":"2019-06-27T03:19:00","slug":"google-pagerank-pr%e5%80%bc%e7%b7%9a%e4%b8%8a%e6%9f%a5%e8%a9%a2php%e4%bb%a3%e7%a2%bc","status":"publish","type":"post","link":"https:\/\/por.tw\/php\/google-pagerank-pr%e5%80%bc%e7%b7%9a%e4%b8%8a%e6%9f%a5%e8%a9%a2php%e4%bb%a3%e7%a2%bc\/","title":{"rendered":"Google PageRank PR\u503c\u7dda\u4e0a\u67e5\u8a62php\u4ee3\u78bc"},"content":{"rendered":"<p><font size=\"4\"><strong><font color=\"#008000\">&nbsp;\u5728\u641c\u5c0b\u5f15\u64ce\u6392\u540dSEO\u6559\u5b78\u4e2d\uff0c\u7e3d\u6559\u982d\u5e38\u63d0\u5230Google PageRank PR\u503c<\/font><br \/> <font color=\"#800080\">\u90a3\u5982\u4f55\u9054\u6210Google PageRank PR\u503c\u7dda\u4e0a\u67e5\u8a62\uff1f\u5176php\u4ee3\u78bc\u53c8\u8a72\u5982\u4f55\u64b0\u5beb\uff1f<\/font><\/strong><\/font><\/p>\n<p> <font size=\"3\"><strong><font color=\"#0000ff\">PR\u503c\u5168\u7a31\u70baPageRank.PageRank(\u7db2\u9801\u5c64\u7d1a)\u662fGoogle\u7528\u65bc\u8a55\u6e2c\u4e00\u500b\u7db2\u9801\u91cd\u8981\u6027\u7684\u4e00\u7a2e\u65b9\u6cd5\u3002<br \/> \u5728\u63c9\u5408\u4e86\u8af8\u5982Title\u6a19\u8b58\u548cKeywords\u6a19\u8b58\u7b49\u6240\u6709\u5176\u5b83\u56e0\u7d20\u4e4b\u5f8c<\/font><\/strong><\/font><font size=\"3\"><strong><font color=\"#0000ff\">\u3002<\/font><\/strong><\/font><br \/> <font size=\"3\"><strong><font color=\"#0000ff\">Google\u901a\u904ePageRank\u4f86\u8abf\u6574\u7d50\u679c.\u4f7f\u90a3\u4e9b\u66f4\u5177\u91cd\u8981\u6027\u7684\u7db2\u9801\u5728\u641c\u5c0b\u7d50\u679c\u4e2d\u53e6\u7db2\u7ad9\u6392\u540d\u7372\u5f97\u63d0\u5347<\/font><\/strong><\/font><font size=\"3\"><strong><font color=\"#0000ff\">\u3002<\/font><\/strong><\/font><br \/> <font size=\"3\"><strong><font color=\"#0000ff\">\u5f9e\u800c\u63d0\u9ad8\u641c\u5c0b\u7d50\u679c\u7684\u95dc\u806f\u6027\u548c\u8cea\u91cf.PR\u503c\u6700\u9ad8\u70ba10.\u4e00\u822cPR\u503c\u9054\u52304.\u5c31\u7b97\u662f\u4e00\u500b\u4e0d\u932f\u7684\u7db2\u7ad9\u4e86<\/font><\/strong><\/font><font size=\"3\"><strong><font color=\"#0000ff\">\u3002<\/font><\/strong><\/font><font size=\"3\"><strong><br \/> <font color=\"#800000\"><br \/> PageRank\u662fgoogle\u641c\u5c0b\u6392\u540d\u7b97\u6cd5\u4e2d\u7684\u4e00\u500b\u7d44\u6210\u90e8\u5206\uff0c\u5c64\u7d1a\u5f9e1\u523010\u7d1a<\/font><\/strong><\/font><font size=\"3\" color=\"#800000\"><strong>\uff0c<\/strong><\/font><font size=\"3\" color=\"#800000\"><strong>10\u7d1a\u70ba\u6eff\u5206<\/strong><\/font><font size=\"3\" color=\"#800000\"><strong>\uff0c<\/strong><\/font><font size=\"3\" color=\"#800000\"><strong>PR\u503c\u8d8a\u9ad8\u8aaa\u660e\u8a72\u7db2\u9801\u5728\u641c\u5c0b\u6392\u540d\u4e2d\u7684\u5730\u4f4d\u8d8a\u91cd\u8981<\/strong><\/font><font size=\"3\" color=\"#800000\"><strong>\u3002<\/strong><\/font><\/p>\n<p> <font size=\"3\"><strong><font color=\"#ff00ff\">\u4e5f\u5c31\u662f\u8aaa,\u5728\u5176\u4ed6\u689d\u4ef6\u76f8\u540c\u7684\u60c5\u6cc1\u4e0b\uff0cPR\u503c\u9ad8\u7684\u7db2\u7ad9\u5728google\u641c\u5c0b\u7d50\u679c\u7684\u6392\u540d\u4e2d\u6709\u512a\u5148\u6b0a\u3002<\/font><\/strong><\/font><br \/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/> &lt; ?php<\/p>\n<p> \/\/ Edit this to your website url:<br \/> $myWebSite = http:\/\/www.mycodes.net;<\/p>\n<p> define(&#39;GMAG&#39;, 0xE6359A60);<\/p>\n<p> \/\/unsigned shift right<br \/> function zeroFill($a, $b) {<br \/> $z = hexdec(80000000);<\/p>\n<p> if ($z &amp; $a) {<br \/> $a = ($a&gt;&gt;1);<br \/> $a &amp;= (~$z);<br \/> $a |= 0x40000000;<br \/> $a = ($a&gt;&gt;($b-1));<br \/> } else {<br \/> $a = ($a&gt;&gt;$b);<br \/> }<\/p>\n<p> return $a;<br \/> }<\/p>\n<p> function mix($a,$b,$c) {<\/p>\n<p> $a -= $b; $a -= $c; $a ^= (zeroFill($c,13));<br \/> $b -= $c; $b -= $a; $b ^= ($a&lt; &amp;lt;8);<br \/> $c -= $a; $c -= $b; $c ^= (zeroFill($b,13));<br \/> $a -= $b; $a -= $c; $a ^= (zeroFill($c,12));<br \/> $b -= $c; $b -= $a; $b ^= ($a&lt;&amp;lt;16);<br \/> $c -= $a; $c -= $b; $c ^= (zeroFill($b,5));<br \/> $a -= $b; $a -= $c; $a ^= (zeroFill($c,3));<br \/> $b -= $c; $b -= $a; $b ^= ($a&lt;&amp;lt;10);<br \/> $c -= $a; $c -= $b; $c ^= (zeroFill($b,15));<\/p>\n<p> return array($a,$b,$c);<br \/> }<\/p>\n<p> function GCH($url, $length=null, $init=GMAG) {<\/p>\n<p> if(is_null($length)) {<br \/> $length = sizeof($url);<br \/> }<\/p>\n<p> $a = $b = 0x9E3779B9;<br \/> $c = $init;<br \/> $k = 0;<br \/> $len = $length;<\/p>\n<p> while($len &gt;= 12) {<br \/> $a += ($url[$k+0] +($url[$k+1]&lt; &amp;lt;8) +($url[$k+2]&lt;&amp;lt;16) +($url[$k+3]&lt;&amp;lt;24));<br \/> $b += ($url[$k+4] +($url[$k+5]&lt;&amp;lt;8) +($url[$k+6]&lt;&amp;lt;16) +($url[$k+7]&lt;&amp;lt;24));<br \/> $c += ($url[$k+8] +($url[$k+9]&lt;&amp;lt;8) +($url[$k+10]&lt;&amp;lt;16)+($url[$k+11]&lt;&amp;lt;24));<br \/> $mix = mix($a,$b,$c);<br \/> $a = $mix[0]; $b = $mix[1]; $c = $mix[2];<br \/> $k += 12;<br \/> $len -= 12;<br \/> }<\/p>\n<p> $c += $length;<\/p>\n<p> switch($len) {\/* all the case statements fall through *\/<br \/> case 11: $c+=($url[$k+10]&lt;&amp;lt;24);<br \/> case 10: $c+=($url[$k+9]&lt;&amp;lt;16);<br \/> case 9 : $c+=($url[$k+8]&lt;&amp;lt;8);<br \/> \/* the first byte of c is reserved for the length *\/<br \/> case 8 : $b+=($url[$k+7]&lt;&amp;lt;24);<br \/> case 7 : $b+=($url[$k+6]&lt;&amp;lt;16);<br \/> case 6 : $b+=($url[$k+5]&lt;&amp;lt;8);<br \/> case 5 : $b+=($url[$k+4]);<br \/> case 4 : $a+=($url[$k+3]&lt;&amp;lt;24);<br \/> case 3 : $a+=($url[$k+2]&lt;&amp;lt;16);<br \/> case 2 : $a+=($url[$k+1]&lt;&amp;lt;8);<br \/> case 1 : $a+=($url[$k+0]);<br \/> \/* case 0: nothing left to add *\/<br \/> }<\/p>\n<p> $mix = mix($a,$b,$c);<br \/> \/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; report the result *\/<br \/> return $mix[2];<br \/> }<\/p>\n<p> \/\/converts a string into an array of integers containing the numeric value of the char<br \/> function strord($string) {<\/p>\n<p> for($i=0;$i&lt;strlen($string);$i++) {<br \/> $result[$i] = ord($string{$i});<br \/> }<\/p>\n<p> return $result;<br \/> }<\/p>\n<p> function getPR($_url) {<\/p>\n<p> $url = &#39;info:&#39;.$_url;<br \/> $ch = GCH(strord($url));<br \/> $url=&#39;info:&#39;.urlencode($_url);<br \/> $pr = file(&quot;http:\/\/www.google.com\/search?client=navclient-auto&amp;ch=6$ch&amp;ie=UTF-8&amp;oe=UTF-8&amp;features=Rank&amp;q=$url&quot;);<br \/> $pr_str = implode(&quot;&quot;, $pr);<\/p>\n<p> return substr($pr_str,strrpos($pr_str, &quot;:&quot;)+1);<br \/> }<\/p>\n<p> echo &quot;&lt;br&gt;The PR of $myWebsite is: &quot;.getPR($myWebSite);<br \/> ?&gt;<br \/> &nbsp;<br \/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u5728\u641c\u5c0b\u5f15\u64ce\u6392\u540dSEO\u6559\u5b78\u4e2d\uff0c\u7e3d\u6559\u982d\u5e38\u63d0\u5230Google PageRank PR\u503c \u90a3\u5982\u4f55\u9054\u6210Goog [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":396,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[22],"class_list":["post-45","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/45"}],"collection":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media\/396"}],"wp:attachment":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}