perl command line pr checker

Discussion in 'Programming' started by Shoemoney, Aug 15, 2005.

  1. Will.Spencer

    Will.Spencer NetBuilder

    Messages:
    14,789
    Likes Received:
    1,040
    Best Answers:
    0
    Trophy Points:
    375
    #21
    s00pah! It works here too! Very nice!
     
    Will.Spencer, Mar 24, 2007 IP
  2. JRBHosting

    JRBHosting Peon

    Messages:
    121
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Working here, as well :)

    Now, to build a simple web interface ;)

    Jason
     
    JRBHosting, Mar 24, 2007 IP
  3. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #23
    amazing this still works almost 2 years old now =P people still bumping threads lol
     
    Shoemoney, Mar 25, 2007 IP
  4. JRBHosting

    JRBHosting Peon

    Messages:
    121
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #24
    Yeah, sorry about the bump :(

    Jason
     
    JRBHosting, Mar 25, 2007 IP
  5. easywab

    easywab Peon

    Messages:
    262
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #25
    Perl PHP experts,
    Can anyone canvert this script to php ?.... Cos. I don't know perl.
     
    easywab, Apr 30, 2007 IP
  6. Will.Spencer

    Will.Spencer NetBuilder

    Messages:
    14,789
    Likes Received:
    1,040
    Best Answers:
    0
    Trophy Points:
    375
    #26
    Why do you need to "know PERL" to run a script?
     
    Will.Spencer, Apr 30, 2007 IP
  7. JRBHosting

    JRBHosting Peon

    Messages:
    121
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #27
    
    <?php
    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));
    
    									   $arr = array($a,$b,$c); 
    									      return $arr;
    									      }
    									      function GoogleCH($arr) {
    									         $url = $arr;
    										    $length = 0;
    										       $init = 0xE6359A60;
    										          $a = 0x9E3779B9;
    											  $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));     
    															      $tmparr = mix($a,$b,$c);
    															            $a = $tmparr[0]; $b = $tmparr[1]; $c = $tmparr[2];
    																          $k += 12;
    																	        $len -= 12;
    																		   }
    																		      
    																		         $c += $length;
    
    																			    while($len <= 11 && $len > 0) {
    																			          if($len == 11)  $c+=($url[$k+10]<<24);
    																				        if($len == 10) $c+=($url[$k+9]<<16);
    																					      if($len == 9) $c+=($url[$k+8]<<8);
    																					            if($len == 8) $b+=($url[$k+7]<<24);
    																						          if($len == 7) $b+=($url[$k+6]<<16);
    																							        if($len == 6) $b+=($url[$k+5]<<8);
    																								      if($len == 5) $b+=($url[$k+4]);
    																								            if($len == 4) $a+=($url[$k+3]<<24);
    																									          if($len == 3) $a+=($url[$k+2]<<16);
    																										        if($len == 2) $a+=($url[$k+1]<<8);
    																											      if($len == 1) $a+=($url[$k+0]);
    																											            $len--;
    																												       }
    																												         
    																													    $tmparr= mix($a,$b,$c);
    																													       return $tmparr[2];
    																													       }
    																													       function strord($string) {
    																													          $result = array();
    
    																														     $char = explode(" ", $string);
    
    																														        for($i=0; $i<strlen($string); $i++) {
    																															      $result[$i] = ord($char[$i]);
    																															         }
    																																    return $result;
    																																    }
    																																    function getrank ($url) {
    																																       $url = 'info:'.$url;
    																																          $ch = GoogleCH(strord($url));
    
    $curl = 0;
    if ($curl) {
    $ch = curl_init();
    curl_setopt($ch,SETOPT_URL,"http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url");
    $file = curl_exec($ch);
    } else {
    $file = file("http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url");
    	
    	}
    	$rankarray = explode("/:|\n/", $file);
    																																		   return $rankarray[4];  
    																																		   }
    																																		   function getPr() {
    																																		      //$getUrl = $address_widget->get_text;
    																																		        // $settext = $pgrankapp->get_widget('rankvalue')->set_text(getrank($getUrl));
    																																			 }
    $rank = getrank($_GET[u]);
    print "Pagerank for $_GET[u]: $rank\n";
    
    ?>
    
    
    PHP:
    Jason
     
    JRBHosting, May 1, 2007 IP
  8. easywab

    easywab Peon

    Messages:
    262
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #28
    easywab, May 7, 2007 IP
  9. WM7

    WM7 Peon

    Messages:
    778
    Likes Received:
    112
    Best Answers:
    0
    Trophy Points:
    0
    #29
    Nice script. working fine for me.
     
    WM7, May 13, 2007 IP
  10. hulkster

    hulkster Peon

    Messages:
    1,705
    Likes Received:
    93
    Best Answers:
    0
    Trophy Points:
    0
    #30
    Here's an "advanced" version using the Perl CPAN module - basically just wraps some error checking around what could not be any simpler ... plus makes it optional to have the leading http://

    
    #!/usr/bin/perl
    # Get GooglePageRank using CPAN Module
    
    use strict;
    use warnings;
    use WWW::Google::PageRank;
    my ($pr, $rank, $url);
    
    if (defined($ARGV[0]) ){
       $url = $ARGV[0];
       $url = "http://" . $url if ($url !~ /^http:\/\//);
       $pr = WWW::Google::PageRank->new();
       $rank = $pr->get($url);
       print "$url has a PageRank of ";
       if (defined($rank)) {
          print "$rank\n";
       } else {
          print "UNDEFINED\n";
       }
    } else {
       print "You must specify a URL ...\n";
    }
    exit;
    
    Code (markup):
     
    hulkster, May 15, 2007 IP
  11. painthappy

    painthappy Peon

    Messages:
    93
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #31
    Hey.. just found this thread... Very nice!
     
    painthappy, May 16, 2007 IP
  12. nshahidch

    nshahidch Peon

    Messages:
    117
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #32
    Is there any PHP code like this as well?
    i didnot know pearl but php....
    So I am saying...
     
    nshahidch, Oct 28, 2008 IP
  13. Will.Spencer

    Will.Spencer NetBuilder

    Messages:
    14,789
    Likes Received:
    1,040
    Best Answers:
    0
    Trophy Points:
    375
    #33
    Post 27 didn't do it for you?
     
    Will.Spencer, Oct 28, 2008 IP
  14. ximazon666

    ximazon666 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #34
    amazing. it still works! :)
     
    ximazon666, Nov 18, 2009 IP
  15. sviedinys

    sviedinys Member

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #35
    Working here!
     
    sviedinys, Nov 29, 2009 IP
  16. hotladylucy

    hotladylucy Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #36
    does it recuires google-licence?
     
    hotladylucy, Jul 21, 2011 IP