Zend - The PHP Company




Utilities

Add Code


rwhois  

Type: code fragment
Added by: joeldg
Entered: 24/10/2002
Last modified: 31/10/2001
Rating: - (fewer than 3 votes)
Views: 4617
Grab rwhois info from ARIN and return it in an array. This is useful for geo-tracking IP's, make your own netIP or whatever.


<?php
function rwhois($query){
    
$fp fsockopen ("rwhois.arin.net"4321$errno$errstr30);
    if (!
$fp) {
            
$ret[] = "$errstr ($errno)n";
    }else{
            
fputs ($fp"$queryrnrn");
        
$count=1;
            while (!
feof($fp) && $count 17) {
            
$back fgets ($fp,128);
            
$data explode(":",$back);
                
$ret[$data[1]] = $data[2];
            
$count++;
            }
//wend
          
fclose ($fp);
    }
//fi
   
return $ret;
}
//end function


print_r(rwhois("64.58.79.230")); //yahoo
?>


Usage Example


output of print_r(rwhois("64.58.79.230")); //yahoo

Array
(
    [003eff] => 00 rwhois.arin.net (by Network Solutions, Inc. V-1.5.7.2)
    [Class-Name] => network
    [Auth-Area] => 0.0.0.0/0
    [ID] => NET-64-58-76-0-1.0.0.0.0/0
    [Handle] => NET-64-58-76-0-1
    [Network-Name] => EC17-1-YAHOO1
    [IP-Network] => 64.58.76.0/22
    [IP-Network-Block] => 64.58.76.0 - 64.58.79.255
    [Org-Name] => Yahoo
    [City] => 701 First Avenue Sunnyvale
    [State] => CA
    [Postal-Code] => 94089
    [Country-Code] => US
    [Tech-Contact;I] => NA258-ARIN.0.0.0.0/0
    [Created] => 20201213050000000
    [Updated] => 19200303050000000
}


Rate This Script





Search



This Category All Categories