1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.
  2. Better Analytics for WordPress Get It Free

Google Page Rank checker code inside (open source) - Question

Discussion in 'Google API' started by Torrentguy, Feb 27, 2006.

  1. #1
    <?php 
    /* 
        This code is released unto the public domain 
    */ 
    header("Content-Type: text/plain; charset=utf-8"); 
    define('GOOGLE_MAGIC', 0xE6359A60); 
    
    //unsigned shift right 
    function zeroFill($a, $b) 
    { 
        $z = hexdec(80000000); 
            if ($z & $a) 
            { 
                $a = ($a>>1); 
                $a &= (~$z); 
                $a |= 0x40000000; 
                $a = ($a>>($b-1)); 
            } 
            else 
            { 
                $a = ($a>>$b); 
            } 
            return $a; 
    } 
    
    
    function mix($a,$b,$c) { 
      $a -= $b; $a -= $c; $a ^= (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; 
        $len = $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 into an array of integers containing the numeric value of the char 
    function strord($string) { 
        for($i=0;$i<strlen($string);$i++) { 
            $result[$i] = ord($string{$i}); 
        } 
        return $result; 
    } 
    // [url]http://www.example.com/[/url] - Checksum: 6540747202 
    $url = 'info:'.$_GET['url']; 
    print("url:\t{$_GET['url']}\n"); 
    $ch = GoogleCH(strord($url)); 
    printf("ch:\t6%u\n",$ch); 
    ?> 
    PHP:
    Just curious as to if anyone else uses this code in their sites, such as iwebtool and others. I was thinking of putting it to use, I see a few people selling sites here that utilize this code, even some selling the code.. maybe some feedback on this would be nice...

    Thanks in advance.
     
    Torrentguy, Feb 27, 2006 IP
  2. Torrentguy

    Torrentguy Member

    Messages:
    87
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    48
    #2
    Torrentguy, Feb 27, 2006 IP
    visioninfotech likes this.
  3. rehash

    rehash Well-Known Member

    Messages:
    1,494
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    100
    #3
    I dont think google agrees with these tools, if they would, then it would have been much simplier, but the way there are, it's pretty obvious someone did reverse engineering on the toolbar which is pretty much illegal
     
    rehash, Mar 1, 2006 IP
  4. mad4

    mad4 Peon

    Messages:
    6,989
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As far as I know this is the only way to get the PR of a page from google.

    Also pretty sure that this is how the keyword tracker tool must work (as there isn't really another way).
     
    mad4, Mar 1, 2006 IP
  5. miles

    miles Well-Known Member

    Messages:
    154
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #5
    Sorry, which keyword tool are you talking about? The one here at DP?

    This code is confusing...Could the thread starter provide some reference to its origin or a URL duscussing it further?
     
    miles, Mar 1, 2006 IP
  6. mad4

    mad4 Peon

    Messages:
    6,989
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes, and probably any other scripts that do the same.

    If google wanted to stop this script working they could quite easily. Or they could make it part of the API.

    I was reading this post about an RK value being passed in the google results XML feed which may be the actual up to date PageRank.
     
    mad4, Mar 1, 2006 IP
  7. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I think the latest PR flux has disproved the theory that RK means current pagerank.
     
    mdvaldosta, Mar 1, 2006 IP
  8. toby

    toby Notable Member

    Messages:
    6,920
    Likes Received:
    269
    Best Answers:
    0
    Trophy Points:
    225
    #8
    Isn't that those scripts illegal? Is it okay with Google?
     
    toby, Mar 1, 2006 IP
  9. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Your not supposed to pull PR without using the API. Any server that runs PR checking code without using the API runs the risk of having that server (IP) blocked from requesting PR in the future. It happens on occasion with those running directory scripts that check PR as well as some SEO software.
     
    mdvaldosta, Mar 1, 2006 IP
  10. mad4

    mad4 Peon

    Messages:
    6,989
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #10
    But is there a way to get PR using the API?
     
    mad4, Mar 1, 2006 IP
  11. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Yea the directory scripts, like phpld, do it.
     
    mdvaldosta, Mar 1, 2006 IP
  12. mad4

    mad4 Peon

    Messages:
    6,989
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Quote from David the owner of phpld on his forum a few weeks ago.
    It looks like phpld uses the script discussed above. dvduval is the owner and is on this forum I think.........
     
    mad4, Mar 1, 2006 IP
  13. miles

    miles Well-Known Member

    Messages:
    154
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #13
    Do you remember where you saw an example of a site deploying a PR checking tool, or even a mass data center PR checking tool, and then getting banned? Everyone is runnng it. Seochat for one.

    How do you figure? I mean there are a million sites running this toolbar hacked code and not a lot G can do about it from where Im standing. My guess is it will be imbedded in the API very soon as you point out - In fact I would be very surprised if it isn't this RK value after all.
     
    miles, Mar 1, 2006 IP
  14. wannaknow

    wannaknow Member

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #14
    Can anyone please give a link to future pagerank/pagerank prediction php script ? I mean the actual source code, not a site providing such a service.
     
    wannaknow, May 18, 2006 IP
  15. websitetools

    websitetools Well-Known Member

    Messages:
    1,469
    Likes Received:
    24
    Best Answers:
    4
    Trophy Points:
    110
    #15
    Check the first post in this thread...? The code is in an iframe.
     
    websitetools, May 30, 2006 IP
  16. mirainfo

    mirainfo Active Member

    Messages:
    988
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    70
    #16
    Hey Guys, Is it bad to query google for this? I thought this is not illigal.
     
    mirainfo, May 30, 2006 IP
  17. wannaknow

    wannaknow Member

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #17
    I was asking for PR prediction script, not current PR detection.
    Also, if anyone has php scripts of backlinks/alexa checking, etc - i will greatly appreciate that.
     
    wannaknow, May 30, 2006 IP
  18. mad4

    mad4 Peon

    Messages:
    6,989
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #18
    You can't predict pagerank, there are no reliable scripts to do this.
     
    mad4, May 31, 2006 IP
  19. desyman

    desyman Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #19
    did anyone tracnscript it to jsp yet ?
    was looking for it for a few weeks, but no success.
    php is good, but need it in jsp.

    can do it on my own, but need extra couple hours, which i have not
     
    desyman, Jun 3, 2006 IP
  20. enampwd

    enampwd Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    I am using a php script which is similar to the above script. I have collected it from internet. But I forgot from where.
     
    enampwd, Jun 24, 2006 IP