Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i've writed some Php code that lookup for domain (whois) but it fails !!

this is some of my code :

function checkdomain($server,$domain){
global $response;
    $connection = fsockopen($server,43);
    fputs($connection, "domain " . $domain . "\r\n");
    while(!feof($connection)){
        $response .= fgets($connection, 4096);
    }
    fclose($connection);
}
checkdomain("whois.crsnic.net","www.example.com");

the code work on my localhost ( apache,php,mysql, OS -> Win XP ) but when i uploaded it to my host (Linux) it failed. and i always see the Below Error/message :

Warning: fsockopen() [function.fsockopen]: unable to connect to whois.crsnic.net:43 
(Network is unreachable) in /home/hamid0011/public_html/whois/whois.php on line 37

what should i do ? is this my host's problem or whois server ( but it work in localhost ) or my code?

share|improve this question
1  
try a manual lookup with the whois command or telnet whois.crsnic.net 43 and see if works there. – SvW Jul 11 '12 at 10:20

1 Answer

up vote 1 down vote accepted

Either your host has blocked outgoing communications on port 43, or the shared server IP you're using has hit the WHOIS server so hard that they've resorted to blocking your IP (not very likely).

In any case, you'll need to contact your host.

Obtaining a traceroute whois.crsnic.net might be useful, if you have shell access. If you can paste one here, we might also be able to debug your issue better (the outputs of the whois command and the telnet one would also be useful as SvenW has said).

share|improve this answer
the problem was in host, my host manager opened the port 43, thank you for answer – hamid Jul 12 '12 at 8:01
No problem - if could please accept the answer by ticking pressing the hollow/green tick on the left, I would appreciate it, thanks :-) – Jay Jul 12 '12 at 12:02
ofcourse this is right, Ad thank you Again for your attention – hamid Jul 12 '12 at 15:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.