|
|
|
Beispiel für Domaincheck (23 Endungen)
Zurück zur Übersicht Dieses Script ermittelt, ob eine Domain bereits registriert ist.
Verbesserte Version:
| PHP |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
|
<?php if(preg_match('/\Ahttps?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?\Z/', 'http://'.$_POST['domain'])) // URL auf validität überprüfen.
{
$whois=array(); // Array initialisieren. Es folgen Deklarationen des mehrdimensionalem Arrays.
$whois['.de']['server']='whois.denic.de';
$whois['.de']['string']='Status: free';
$whois['.com']['server']='whois.crsnic.net';
$whois['.com']['string']='No match for';
$whois['.net']['server']='whois.crsnic.net';
$whois['.net']['string']='No match for';
$whois['.org']['server']='whois.publicinterestregistry.net';
$whois['.org']['string']='NOT FOUND';
$whois['.info']['server']='whois.afilias.net';
$whois['.info']['string']='NOT FOUND';
$whois['.biz']['server']='whois.nic.biz';
$whois['.biz']['string']='Not found';
$whois['.ag']['server']='whois.nic.ag';
$whois['.ag']['string']='NOT FOUND';
$whois['.am']['server']='whois.nic.am';
$whois['.am']['string']='No match';
$whois['.as']['server']='whois.nic.as';
$whois['.as']['string']='Domain Not Found';
$whois['.at']['server']='whois.nic.at';
$whois['.at']['string']='nothing found';
$whois['.be']['server']='whois.dns.be';
$whois['.be']['string']='Status: FREE';
$whois['.cd']['server']='whois.cd';
$whois['.cd']['string']='No match';
$whois['.ch']['server']='whois.nic.ch';
$whois['.ch']['string']='not have an entry';
$whois['.cx']['server']='whois.nic.cx';
$whois['.cx']['string']='Status: Not Registered';
$whois['.dk']['server']='whois.dk-hostmaster.dk';
$whois['.dk']['string']='No entries found';
$whois['.it']['server']='whois.nic.it';
$whois['.it']['string']='Status: AVAILABLE';
$whois['.li']['server']='whois.nic.li';
$whois['.li']['string']='do not have an entry';
$whois['.lu']['server']='whois.dns.lu';
$whois['.lu']['string']='No such domain';
$whois['.nu']['server']='whois.nic.nu';
$whois['.nu']['string']='NO MATCH for';
$whois['.ru']['server']='whois.ripn.net';
$whois['.ru']['string']='No entries found';
$whois['.uk.com']['server']='whois.centralnic.com';
$whois['.uk.com']['string']='No match for';
$whois['.eu.com']['server']='whois.centralnic.com';
$whois['.eu.com']['string']='No match';
$whois['.ws']['server']='whois.nic.ws';
$whois['.ws']['string']='No match for';
$domain=str_replace('www.', '', $_POST['domain']); // Solche Dinge sind Detailssache (..) Letztlich muss die Anfrage an den WHOIS-Server ohne http::// , www. usw. stattfinden. -> Nur Domainname und Domainendung.
if(get_magic_quotes_gpc==0)
{
$domain=addslashes($domain);
}
// Verbindung zum whois server aufbauen / Status der Domain erfragen.
$check=fsockopen($whois[$_POST['tld']]['server'], 43);
fputs($check, $domain.$_POST['tld']."\r\n");
while(!feof($check))
{
$report=$report.fgets($check, 128);
}
fclose($check);
if(ereg($whois[$_POST['tld']]['string'], $report)) // Was soll geschehen, wenn domain noch frei ist?
{
print('domain frei.');
}
else // Was, wenn nicht?
{
print('domain nicht frei.');
}
}
?>
|
|
Hinweiß: Die WHOIS-Server von den TLDs li, ch haben eine recht strenge Begrenzung der Anfragen innerhalb eines bestimmten Zeitraums.
Gruß,
peter.
Kommentare
Zurück zur Übersicht
Autor peter
|
|
|
|