Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

whois2 php script

Status
Not open for further replies.
Joined
Sep 28, 2006
Posts
402
Reaction score
6
Im hoping someone can help

Ive written a script that should work but doesnt. Taking a whois lookup on port 43 and changed to 1043 and included host & IP. Using port 43 works fine so cant see what ive missed.

Code:
<?php
$fp = fsockopen('whois.nic.uk', 1043, $errno, $errstr);
if (!$fp) {
   echo "ERROR: $errno - $errstr<br />\n";
} else {
   fwrite($fp, "myhome.hostname myhome.ip.address yahoo.co.uk\r\n");
   while (!feof($fp)) {
      echo str_replace("\n", '<br />', fread($fp, 100));
   }
   fclose($fp);
}
?>

Ive got the email which accept I now have access to WHOIS2 from the IP address 65.99.[remove].233.85. The domain is on a VPS so have given the domain its own IP address but the script still times out.

Code:
Warning: fsockopen() [function.fsockopen]: unable to connect to whois.nic.uk:1043 in /home/daily/public_html/who.php on line 3
ERROR: 110 - Connection timed out

Please help.
 
Last edited:
Is the IP you're trying to connect to whois2 from allowed?

"The service will be available on a subscription only basis. At the point of subscription you will need to provide Nominet with the IP address of your gateway."

S
 
Looks ok, I just use something like this with np

PHP:
$whois = 'whois.nic.uk';
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$ip = $_SERVER["REMOTE_ADDR"];
$domain = 'internet.co.uk';

$fs = fsockopen("$whois", 1043, $errno, $errstr, 60);
if (!$fs) {
   fclose($fs);
} else {

        fputs($fs, "$hostname $ip $domain\r\n");
        $contents = stream_get_contents($fs);
        fclose($fs);
 
Ive got the email which accept I now have access to WHOIS2 from the IP address 65.99.[remove].233.85. The domain is on a VPS so have given the domain its own IP address but the script still times out.

Maybe make sure your connecting from the domains IP not the servers main IP. Most likely connections would come from the servers IP unless you use bind to bind a specific IP to your script. You should be able to see what outgoing connections are running using netstat.
 
tifosi... yes ive been accepted and the IP being shown from the domain/script is the IP whois2 has granted access. I put this towards the bottom of my first post.

aquanuke...
Thanks i'll give that a try. From shell im getting the correct address also phpinfo shows the correct IP
SERVER_ADDR 65.99.233.85
SERVER_NAME dailydomain.co.uk

The message from both our scripts seems to suggest im not even getting to nic.uk? let alone not being granted access or not.

Warning: fsockopen() [function.fsockopen]: unable to connect to whois.nic.uk:1043 in /home/daily/public_html/who2.php on line 7
 
Last edited:
Can you telnet to whois2 from the server? If so it will either let you in or close the connection if its an ip registration problem. Either way it will prove whether your script/server is at fault or not.

Grant
 
Probs easier just to bind the IP through the script, try this through a web browser.

PHP:
<?
$sourceip = 'xx.xxx.xx.xx'; // ip you want to bind to
$whois = 'whois.nic.uk';
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$ip = $_SERVER["REMOTE_ADDR"];
$domain = 'internet.co.uk';

$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($sock, $sourceip);
socket_connect($sock, "$whois", 1043);

socket_write ($sock, "$hostname $ip $domain\r\n");
$line = socket_read($sock, 1024);

echo $line;
?>
 
Thanks guys but still nothing.... this is getting annoying so will try phoning Nominet Monday for ideas. Im starting to think they sent the email telling me I have access without really granting access to the IP.

Ive posted a site im working on (dailydomain.co.uk), but until this is working the public wont be able to update or lookup whois info which is a shame.
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom