This code show whois information of a domain. $domain = 'digitalpoint.com'; $whois = ''; $connection = @fsockopen('whois.verisign-grs.com', 43); if ($connection) { @fputs($connection, $domain ."\r\n"); while (!feof($connection)) { $whois .= @fgets($connection, 128); } } fclose($connection); echo $whois; PHP: but, when $domain = 'cnn.com'; Code (markup): result: CNN.COM.MORE.INFO.AT.WWW.BEYONDWHOIS.COM CNN.COM.IS.0WN3D.BY.GULLI.COM CNN.COM Any one can give me a hint how to get the correct whois information of that domain (lie cnn.com). Many thanks.
Hi, why don't you use the built-in whois command in the linux server. Here is a sample code <?php /** * @file ipdomains.php * * A simple WHOIS (wrapper) object written in PHP. Specially for the LINUX servers. * * @author Saravanan <doraiswamy.saravanan@gmail.com> * * */ class whois { var $cmd; function whois() { $this->set_whois_cmd(); return; } function set_whois_cmd() { if (file_exists('/usr/local/bin/whois')) { $this->cmd = '/usr/local/bin/whois'; } elseif (file_exists('/usr/bin/whois')) { $this->cmd = '/usr/bin/whois'; } elseif (file_exists('/bin/whois')) { $this->cmd = '/bin/whois'; } else { die("<h1>Error:</h1>\n<p>Couldn't locate the 'whois' program.</p>"); } } function query($domain) { /** * return the whois results with text linebreaks converted into html linebreaks */ return nl2br(shell_exec(escapeshellcmd($this->cmd ." ". $domain))); } } $ob = new whois(); echo $ob->query('google.com'); ?> Code (markup): regards, d_s