Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. 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 ?

TNX

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.

add comment

1 Answer 1

up vote 3 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
add comment

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