Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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");
        $response .= fgets($connection, 4096);

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

closed as off topic by John Conde Jul 11 '12 at 11:24

Questions on Webmasters Stack Exchange are expected to relate to webmastering within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 4 down vote accepted

Your host probably has a firewall which blocks port 43. I would contact them to check if this is the case.

share|improve this answer
thanks , yes i solved the problem – hamid Jul 12 '12 at 15:56
What was the problem out of interest? – paulmorriss Jul 12 '12 at 16:04
the socket was blocked by host admin. – hamid Jul 13 '12 at 15:09

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