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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.