| AND OR | string words | *

information

|

domaincheck

| see demonstration of domaincheck


check domain name availability


function get_whois_server( ) [ line 39 ]


function lookup( ) [ line 65 ]



full source of domaincheck [ line 1 - 105 ] | download domaincheck

1    <?php echo '<!-- '.date('d m y').' -->'?>
2   <html>
3      <head>
4       <title>domaincheck</title>
5      </head>
6      <body>
7      <table border="0" cellpadding="0" cellspacing="5" align="center">
8       <tr>
9        <td>
10         <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
11          <b>Domain (ohne www.):</b>
12          <input type="text" name="dom">
13          <select name="endung">
14           <option value=".de">.de</option>
15           <option value=".com">.com</option>
16           <option value=".net">.net</option>
17           <option value=".org">.org</option>
18           <option value=".info">.info</option>
19           <option value=".biz">.biz</option>
20           <option value=".at">.at</option>
21           <option value=".ch">.ch</option>
22           <option value=".li">.li</option>
23           <option value=".co.uk">.co.uk</option>
24           <option value=".tv">.tv</option>
25           <option value=".cc">.cc</option>
26           <option value=".dk">.dk</option>
27           <option value=".it">.it</option>
28           <option value=".ws">.ws</option>
29           </select>
30          <input type="submit" name="Submit" value="Check">
31         </form>
32      <?php
33      if ($_POST['dom'])
34      {
35       $dom $_POST['dom'].$_POST['endung'];
36       $whoisresult lookup($dom);
37       print '<pre>'.$whoisresult.'</pre>';
38      }
39      function get_whois_server($domain)
40      {
41       $whoisservers array(array('de','whois.denic.de'),
42       array('com','rs.internic.net'),
43       array('net','rs.internic.net'),
44       array('org','whois.networksolutions.com'),
45       array('info','whois.afilias.net'),
46       array('biz','whois.biz'),
47       array('at','whois.nic.at'),
48       array('ch','whois.nic.ch'),
49       array('li','whois.nic.ch'),
50       array('co.uk','whois.nic.uk'),
51       array('tv','whois.<a href = "http://www.tv" target = "_blank">www.tv</a>'),
52       array('cc','whois.enicregistrar.com'),
53       array('dk','whois.dk-hostmaster.dk'),
54       array('it','whois.nic.it'),
55       array('ws','whois.worldsite.ws'));
56       $whocnt count($whoisservers);
57       for ($x 0;$x<$whocnt;$x++)
58       {
59        $artld $whoisservers[$x][0];
60        $tldlen intval(strlen($artld));
61        if (substr($domain$tldlen) == $artld$whosrv $whoisservers[$x][1];
62       }
63       return $whosrv;
64      }
65      function lookup($dom)
66      {
67       $lusrv get_whois_server($dom);
68       if (!$lusrv) return '';
69       $fp fsockopen($lusrv,43);
70       fputs($fp,$dom."rn");
71       $string '';
72       while(!feof($fp))
73       {
74        $string .= fgets($fp,128);
75       }
76       fclose($fp);
77       $reg "/Whois Server: (.*?)n/i";
78       preg_match_all($reg$string$matches);
79       $secondtry $matches[1][0];
80       if ($secondtry)
81       {
82        $fp fsockopen($secondtry,43);
83        fputs($fp$dom."rn");
84        $string '';
85        while(!feof($fp))
86        {
87         $string .= fgets($fp,128);
88        }
89        fclose($fp);
90       }
91       if(ereg('(No match|No entries found|NOT FOUND|Not found)',$string))
92       {
93        echo '<b>Die suche nach '.$dom.' hat folgendes Ergebnis geliefert:</</b>';
94       }else{
95        echo '<b>Die suche nach '.$dom.' hat folgendes Ergebnis geliefert:</b>';
96        $whois $string;
97        return $whois;
98       }
99      }
100      ?>
101          </td>
102        </tr>
103      </table>
104      </body>
105      </html>



22 hits by 10 users in the last 30 minutes.