communication
 databases
 directories
 file handling
 html and code
 image editing
 image listing
 sessions and co
 string handling
 information
 forms
 apple stuff
 image handling
 array handling
 lixlpixel
php - snippets
google search terms detected and highlighted.
remove highlighting | keep highlighting
make snippet in "information" - download "domaincheck" - open demo of "domaincheck"
 search
php - snippets

Valid CSS!

php webring logo
prev next
random list
join the Ring!

information - domaincheck was created/last modified on Mon 22 Mar 2004 8:32 PM

<html>
    <head>
     <title>domaincheck</title>
    </head>
    <body>
    
    <table border="0" cellpadding="0" cellspacing="5" align="center">
     <tr>
      <td>
       <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
        <b>Domain (ohne www.):</b>
        <input type="text" name="dom">
        <select name="endung">
         <option value=".de">.de</option>
         <option value=".com">.com</option>
         <option value=".net">.net</option>
         <option value=".org">.org</option>
         <option value=".info">.info</option>
         <option value=".biz">.biz</option>
         <option value=".at">.at</option>
         <option value=".ch">.ch</option>
         <option value=".li">.li</option>
         <option value=".co.uk">.co.uk</option>
         <option value=".tv">.tv</option>
         <option value=".cc">.cc</option>
         <option value=".dk">.dk</option>
         <option value=".it">.it</option>
         <option value=".ws">.ws</option>
         </select>
        <input type="submit" name="Submit" value="Check">
       </form>
    <?php
    
if ($_POST['dom'])
    {
     
$dom = $_POST['dom'].$_POST['endung'];
     
$whoisresult = lookup($dom);
     print
'<pre>'.$whoisresult.'</pre>';
    }
    
    function
get_whois_server($domain)
    {
     
$whoisservers = array(array('de','whois.denic.de'),
     array(
'com','rs.internic.net'),
     array(
'net','rs.internic.net'),
     array(
'org','whois.networksolutions.com'),
     array(
'info','whois.afilias.net'),
     array(
'biz','whois.biz'),
     array(
'at','whois.nic.at'),
     array(
'ch','whois.nic.ch'),
     array(
'li','whois.nic.ch'),
     array(
'co.uk','whois.nic.uk'),
     array(
'tv','whois.<a href = "http://www.tv" target = "_blank">www.tv</a>'),
     array(
'cc','whois.enicregistrar.com'),
     array(
'dk','whois.dk-hostmaster.dk'),
     array(
'it','whois.nic.it'),
     array(
'ws','whois.worldsite.ws'));
     
$whocnt = count($whoisservers);
     for (
$x = 0;$x<$whocnt;$x++)
     {
      
$artld = $whoisservers[$x][0];
      
$tldlen = intval(0 - strlen($artld));
      if (
substr($domain, $tldlen) == $artld) $whosrv = $whoisservers[$x][1];
     }
     return
$whosrv;
    }
    
    function
lookup($dom)
    {
     
$lusrv = get_whois_server($dom);
     if (!
$lusrv) return '';
     
$fp = fsockopen($lusrv,43);
     
fputs($fp,$dom."\r\n");
     
$string = '';
     while(!
feof($fp))
     {
      
$string .= fgets($fp,128);
     }
     
fclose($fp);
     
$reg = "/Whois Server: (.*?)\n/i";
     
preg_match_all($reg, $string, $matches);
     
$secondtry = $matches[1][0];
     if (
$secondtry)
     {
      
$fp = fsockopen($secondtry,43);
      
fputs($fp, $dom."\r\n");
      
$string = '';
      while(!
feof($fp))
      {
       
$string .= fgets($fp,128);
      }
      
fclose($fp);
     }
     if(
ereg('(No match|No entries found|NOT FOUND|Not found)',$string))
     {
      echo
'<b>Die suche nach '.$dom.' hat folgendes Ergebnis geliefert:</</b>';
     }else{
      echo
'<b>Die suche nach '.$dom.' hat folgendes Ergebnis geliefert:</b>';
      
$whois = $string;
      return
$whois;
     }
    }
    
?>
        </td>
      </tr>
    </table>
    
    </body>
    </html>

learn more about some of the PHP functions used in this snippet: align, array, count, dl, echo, else, end, ereg, fclose, feof, fgets, for, fputs, fsockopen, function, intval, ord, preg_match, preg_match_all, print, return, strlen, substr, while

view the GNU general license - view the GNU library license - search on PHPsnippets - see your code like this

 a lixlpixel.com site

go to PHParadise to get free PHP, Javascript and FlashMX code