Şimdi Ara

Pagerank PHP Öğrenme Kodu

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
1 Misafir - 1 Masaüstü
5 sn
1
Cevap
0
Favori
360
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Merhabalar..Sitenizin Pagerank değerini öğrenmek istiyorsunuz veya sitenizde pagerank değerini sorgulatmak istiyorsunuz..Bunun icin Yapmanız gereken bu PHP kodunu alıp istediğiniz yere yapıştırmaktır…Böylece hem Sitenizde Google Pagerank sorgulatırsınız hemde kendi sitenizin pagerank değerini öğrenirsiniz..

    </p> 
    <form action="" method="post">
    <table align="center" style="width: 359px; height: 81px;border: 2px dashed #000066;">
    <tr>
    <td style="background-color: #DDFFFF;width: 57px">URL:</td>
    <td style="background-color: #DDFFFF;width: 112px">
    <input name="url" type="text" style="width: 289px; height: 23px" value="http://"></td>
    </tr>
    <tr>
    <td style="width: 57px"> </td>
    <td style="width: 112px">
    <input name="Submit1" style="width: 133px; height: 29px;" type="submit" value="Find Page Rank"></td>
    </tr>
    </table>
    </form>
    <p><?php<br />
    if (isset($_POST['url'])){<br />
    $pgr=new GooglePageRankChecker;<br />
    $url=$_POST['url'];<br />
    $rank = $pgr->getRank($url);<br />
    echo ‘</p>
    <p style="text-align: center;"><span style="font-size: 20pt;color: #0000FF; border-style:dotted;border-width: 1px;background-color: #FFFFCC;<br />
    "><a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=84370694&url='.$url.'" class="broken_link" data-href="'.$url.'" class="broken_link">‘.$url.’</a></span><br />
    <span style="font-size: 18pt;color: #0000FF;border-style:dotted;border-width: 1px;background-color: #FFFFCC;">  The Page Rank is: ’.$rank.’  </span></p>
    <p> ‘;<br />
    }</p>
    <p>class GooglePageRankChecker {</p>
    <p> // Track the instance<br />
    private static $instance;</p>
    <p> // Constructor<br />
    function getRank($page) {<br />
    // Create the instance, if one isn’t created yet<br />
    if(!isset(self::$instance)) {<br />
    self::$instance = new self();<br />
    }<br />
    // Return the result<br />
    return self::$instance->check($page);<br />
    }</p>
    <p> // Convert string to a number<br />
    function stringToNumber($string,$check,$magic) {<br />
    $int32 = 4294967296; // 2^32<br />
    $length = strlen($string);<br />
    for ($i = 0; $i < $length; $i++) {<br />
    $check *= $magic;<br />
    //If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31),<br />
    // the result of converting to integer is undefined<br />
    // refer tohttp://www.php.net/manual/en/language.types.integer.php<br />
    if($check >= $int32) {<br />
    $check = ($check – $int32 * (int) ($check / $int32));<br />
    //if the check less than -2^31<br />
    $check = ($check < -($int32 / 2)) ? ($check + $int32) : $check;<br />
    }<br />
    $check += ord($string{$i});<br />
    }<br />
    return $check;<br />
    }</p>
    <p> // Create a url hash<br />
    function createHash($string) {<br />
    $check1 = $this->stringToNumber($string, 0×1505, 0×21);<br />
    $check2 = $this->stringToNumber($string, 0, 0x1003F);</p>
    <p> $factor = 4;<br />
    $halfFactor = $factor/2;</p>
    <p> $check1 >>= $halfFactor;<br />
    $check1 = (($check1 >> $factor) & 0x3FFFFC0 ) | ($check1 & 0x3F);<br />
    $check1 = (($check1 >> $factor) & 0x3FFC00 ) | ($check1 & 0x3FF);<br />
    $check1 = (($check1 >> $factor) & 0x3C000 ) | ($check1 & 0x3FFF); </p>
    <p> $calc1 = (((($check1 & 0x3C0) << $factor) | ($check1 & 0x3C)) << $halfFactor ) | ($check2 & 0xF0F );<br />
    $calc2 = (((($check1 & 0xFFFFC000) << $factor) | ($check1 & 0x3C00)) << 0xA) | ($check2 & 0xF0F0000 );</p>
    <p> return ($calc1 | $calc2);<br />
    }</p>
    <p> // Create checksum for hash<br />
    function checkHash($hashNumber)<br />
    {<br />
    $check = 0;<br />
    $flag = 0;</p>
    <p> $hashString = sprintf('%u', $hashNumber) ;<br />
    $length = strlen($hashString);</p>
    <p> for ($i = $length - 1; $i >= 0; $i –) {<br />
    $r = $hashString{$i};<br />
    if(1 === ($flag % 2)) {<br />
    $r += $r;<br />
    $r = (int)($r / 10) + ($r % 10);<br />
    }<br />
    $check += $r;<br />
    $flag ++;<br />
    }</p>
    <p> $check %= 10;<br />
    if(0 !== $check) {<br />
    $check = 10 – $check;<br />
    if(1 === ($flag % 2) ) {<br />
    if(1 === ($check % 2)) {<br />
    $check += 9;<br />
    }<br />
    $check >>= 1;<br />
    }<br />
    }</p>
    <p> return ’7′.$check.$hashString;<br />
    }</p>
    <p> function check($page) {</p>
    <p> // Open a socket to the toolbarqueries address, used by <a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=84370694&url=http://nedir.doramimarlik.net/tag/google-toolbar/" data-href="http://nedir.doramimarlik.net/tag/google-toolbar/">Google Toolbar</a><br />
    $socket = fsockopen(“toolbarqueries.google.com”, 80, $errno, $errstr, 30);</p>
    <p> // If a connection can be established<br />
    if($socket) {<br />
    // Prep socket headers<br />
    $out = “GET /tbr?client=navclient-auto&ch=”.$this->checkHash($this->createHash($page)).<br />
    “&features=Rank&q=info:”.$page.”&num=100&filter=0 HTTP/1.1rn”;<br />
    $out .= “Host: toolbarqueries.google.comrn”;<br />
    $out .= “User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 2.0.114-big; Windows XP 5.1)rn”;

    $out .= “Connection: Closernrn”;</p>
    <p> // Write settings to the socket<br />
    fwrite($socket, $out);</p>
    <p> // When a response is received…<br />
    $result = “”;<br />
    while(!feof($socket)) {<br />
    $data = fgets($socket, 128);<br />
    $pos = strpos($data, “Rank_”);<br />
    if($pos !== false){<br />
    $pagerank = substr($data, $pos + 9);<br />
    $result += $pagerank;<br />
    }<br />
    }<br />
    // Close the connection<br />
    fclose($socket);</p>
    <p> // Return the rank!<br />
    return $result;<br />
    }<br />
    }<br />
    }<br />
    ?></p>
    <p><font face="Tahoma"><a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=84370694&url=http://nedir.doramimarlik.net" data-href="http://nedir.doramimarlik.net"><span style="font-size: 8pt; text-decoration: none">PHP kod sitesi</span></a></font>







  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.