mod_whois.php by Carl Pickering

Discuss the development and implementation of Joomla! modules here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
MadMaxx
I've been banned!
Posts: 16
Joined: Fri Jun 30, 2006 7:16 am

mod_whois.php by Carl Pickering

Post by MadMaxx » Mon Sep 11, 2006 1:15 pm

I made some integrations in the module mod_whois.php. If you need a quick and light domain name availability module, this is perfect.

...

.it
.eu
.com
.net
.org
.info
.biz
.co.uk
.de
.nl
.us
.edu
.gov
.mil
.tk

...

if ($ext == 'com'){
  $domname = "$dom.com";
  $ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
  if (eregi('Can\'t get information',$result)) available(); else unavailable();
  }
if ($ext == 'net'){
  $domname = "$dom.net";
  $ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
  if (eregi('Can\'t get information',$result)) available(); else unavailable();
  }
if ($ext == 'org'){
  $domname = "$dom.org";
  $ns = fsockopen('whois.publicinterestregistry.com',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
  if (eregi('NOT FOUND',$result)) available(); else unavailable();
  }
if ($ext == 'info'){
  $domname = "$dom.info";
  $ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
  if (eregi('Not found',$result)) available(); else unavailable();
  }
if ($ext == 'biz'){
  $domname = "$dom.biz";
  $ns = fsockopen('whois.nic.biz',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
  if (eregi('Not found',$result)) available(); else unavailable();
  }
if ($ext == 'co.uk'){
  $domname = "$dom.co.uk";
  $ns = fsockopen('whois.nic.uk',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
  if (eregi('No match',$result)) available(); else unavailable();
  }
}if ($ext == 'it'){
  $domname = "$dom.it";
  $ns = fsockopen('whois.nic.it',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
  if (eregi('No entries found',$result)) available(); else unavailable();
  }
if ($ext == 'de'){
  $domname = "$dom.de";
  $ns = fsockopen('whois.nic.de',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
if (eregi('free',$result)) available(); else unavailable();
  }
if ($ext == 'nl'){
    $domname = "$dom.nl";
    $ns = fsockopen('whois.domain-registry.nl',43); fputs($ns,"$domname\r\n");
    $result = '';
    while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
    if (eregi('free',$result)) available(); else unavailable();
    }
  if ($ext == 'tk'){
    $domname = "$dom.tk";
    $ns = fsockopen('whois.dot.tk',43); fputs($ns,"$domname\r\n");
    $result = '';
    while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
    if (eregi('not known',$result)) available(); else unavailable();
    }
  if ($ext == 'us'){
    $domname = "$dom.us";
    $ns = fsockopen('whois.nic.us',43); fputs($ns,"$domname\r\n");
    $result = '';
    while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
    if (eregi('Not found:',$result)) available(); else unavailable();
    }
  if ($ext == 'mil'){
    $domname = "$dom.mil";
    $ns = fsockopen('whois.internic.net',43); fputs($ns,"$domname\r\n");
    $result = '';
    while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
    if (eregi('No match',$result)) available(); else unavailable();
    }
  if ($ext == 'edu'){
    $domname = "$dom.edu";
    $ns = fsockopen('whois.internic.net',43); fputs($ns,"$domname\r\n");
    $result = '';
    while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
    if (eregi('No match',$result)) available(); else unavailable();
    }
  if ($ext == 'gov'){
    $domname = "$dom.gov";
    $ns = fsockopen('whois.nic.gov',43); fputs($ns,"$domname\r\n");
    $result = '';
    while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
    if (eregi('No match for',$result)) available(); else unavailable();
    }
if ($ext == 'eu'){
  $domname = "$dom.eu";
  $ns = fsockopen('whois.eu',43); fputs($ns,"$domname\r\n");
  $result = '';
  while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
  if (eregi('FREE',$result)) available(); else unavailable();
  }

You can see how it works at http://www.mediaworks.it.

Version:    2.5.7 :: 25th October 2004
Author:    Carl Pickering :: cpickering@its-linux.co.uk
Company:    ITS Linux Ltd :: http://www.its-linux.co.uk

 
 
Locked

Return to “Modules”