Jump to content

arin whois


knowram

Recommended Posts

I found this chunk of code. but it is from 2000 and I have not been able to get it to work. dose anyone have any idea.

[code]
<?php
################################################
# rWhois
# inputs: IP address
# outputs: array of rWhois info from first referral
################################################
function rwhois($query){
    $fp = fsockopen ("rwhois.arin.net", 4321, $errno, $errstr, 30);
    if (!$fp) {
            $ret[] = "$errstr ($errno)\n";
    }else{
            fputs ($fp, "$query\r\n\r\n");
        $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
?>
[/code]

thanks for the help this would make life much easier for me if it will work
Link to comment
https://forums.phpfreaks.com/topic/30063-arin-whois/
Share on other sites

Sorry. At first I was getting a can not connect error. but now after changing some things I just don't get the right out put.

here is the new code

[code]
<?php
################################################
# rWhois
# inputs: IP address
# outputs: array of rWhois info from first referral
################################################
function rwhois($query){
    $fp = fsockopen ("www.arin.net", 80, $errno, $errstr, 30);
    if (!$fp) {
            $ret[] = "$errstr ($errno)\n";
    }else{
            fwrite ($fp, "$query\r\n\r\n");
        $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
[/code]

and here is the out put that I get.

Array ( [] => [//www.arin.net/index.shtml">here.
] => )

thanks for the help
Link to comment
https://forums.phpfreaks.com/topic/30063-arin-whois/#findComment-138264
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.