Mailinglisten-Archive |
This is a multi-part message in MIME format.
------=_NextPart_000_0042_01BFD154.6038B390
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: 8bit
Hallo Andreas
> Hallo Liste,
>
> kennt jemand ein Script oder Codesnipsel, mit welchem ich die
> Verfügbarkeit von DE als auch von COM/NET/ORG Domains testen kann?
Beiliegend den Code (hab ich von webdev)
Mit dem String $name kannst Du die Abfrage starten.
> Danke
> Andreas
mfg
Andi
------=_NextPart_000_0042_01BFD154.6038B390
Content-Type: php3/octet-stream;
name="internic.php3"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="internic.php3"
<?PHP
// Whois hosts locate particular domains. An entry is needed for=20
// If you don't have matched pairs below a script generated error =
notifies you of the fact.
$domain[] =3D ".com";
$host[] =3D "whois.internic.net";
$domain[] =3D ".org";
$host[] =3D "whois.internic.net";
$domain[] =3D ".net";
$host[] =3D "whois.internic.net";
$domain[] =3D ".ch";
$host[] =3D "whois.internic.ch";
$domain[] =3D ".de";
$host[] =3D "whois.internic.de";
// End of whois host/domain list
Function checkRegistered($res)
{
$rval=3Dtrue;
if(gettype($res)=3D=3D"array")
{
for($i=3D0;$i<count($res[0]);$i++)
{
if(empty($res[0][$i]))
$res[0][$i] =3D "";
if(strstr($res[0][$i],"No match for")!=3Dfalse)
{
$rval=3Dfalse;
}
}
}
return $rval;
}
Function whois($domainName, $server)
{
$whoisQuery =3D "whois -h $server $domainName";
// $whoisQuery =3D "dir";
exec($whoisQuery, $whoisResult[], $whoisReturnValue);
// echo $whoisQuery;
// echo "<br>\n";
$reg =3D checkRegistered($whoisResult);
echo " <TR>\n";
echo " <TD WIDTH=3D\"33%\" VALIGN=3DTOP>\n";
echo " <FONT FACE=3D\"Arial,Helvetica,Monaco\" SIZE=3D\"2\">\n";
echo " ";
echo $domainName;
echo "\n";
echo " </FONT></TD>\n";
echo " <TD WIDTH=3D\"33%\" VALIGN=3DTOP>\n";
echo " <FONT FACE=3D\"Arial,Helvetica,Monaco\" SIZE=3D\"2\">\n";
if($reg)
{
echo " ";
echo "Already registered";
echo "\n";
}
else
{
echo " <FONT COLOR=3D\"RED\">\n";
echo " ";
echo "Available";
echo "\n";
echo " </FONT>\n";
}
echo " </TD>\n";
echo " </TR>\n";
}
Function head()
{
echo "<HTML>\n";
echo " <HEAD>\n";
echo " <TITLE>Is That Taken?</TITLE>\n";
echo " </HEAD>\n";
echo " <BODY BGCOLOR=3D\"WHITE\">\n";
echo " <H2 ALIGN=3DCENTER>\n";
echo " <FONT FACE=3D\"Arial,Helvetica,Monaco\"><FONT =
SIZE=3D\"6\"><FONT COLOR=3D\"RED\">\n";
echo " Is It Taken?</FONT></FONT></FONT></H2>\n";
echo " \n";
echo " <H4 ALIGN=3DCENTER>\n";
}
Function wait_msg()
{
echo " <FONT FACE=3D\"Arial,Helvetica,Monaco\" SIZE=3D\"2\">\n";
echo " Please be patient, this can take a few moments...\n";
echo " </FONT></H4>\n";
flush();
}
Function table_head()
{
echo " <CENTER>\n";
echo " <P ALIGN=3DCENTER>\n";
echo " <TABLE WIDTH=3D\"80%\" CELLPADDING=3D\"2\" =
CELLSPACING=3D\"0\" BORDER=3D\"1\">\n";
echo " <TR>\n";
echo " <TD WIDTH=3D\"33%\" VALIGN=3DTOP>\n";
echo " <FONT FACE=3D\"Arial,Helvetica,Monaco\"><FONT =
SIZE=3D\"3\"><B>Domain</B></FONT></FONT></TD>\n";
echo " <TD WIDTH=3D\"33%\" VALIGN=3DTOP>\n";
echo " <FONT FACE=3D\"Arial,Helvetica,Monaco\"><FONT =
SIZE=3D\"3\"><B>Status</B></FONT></FONT></TD>\n";
echo " </TR>\n";
}
Function table_foot()
{
echo " </TABLE>\n";
echo " </CENTER>\n";
}
Function foot()
{
echo " <P ALIGN=3DCENTER>\n";
echo " <A HREF=3D\"whois.html\"><IMG SRC=3D\"larrow.gif\" =
WIDTH=3D\"128\" HEIGHT=3D\"20\" VSPACE=3D\"0\" HSPACE=3D\"0\" =
ALT=3D\"See if something else is taken.\" BORDER=3D\"0\" =
LOOP=3D\"0\"></A>\n";
echo " </BODY>\n";
echo "</HTML>\n";
}
if(empty($name))
$name =3D "";
$name =3D strtolower($name);
$base =3D "";
$dom =3D "";
if($name<>"")
{
if(strcmp("www.",substr($name,0,4))=3D=3D0)
$name =3D substr($name,4,strlen($name)-4);
$base =3D strtok($name,".");
if($base)
{
$tok =3D strtok(".");
while($tok)
{
$dom .=3D "." . $tok;
$tok =3D strtok(".");
}
}
}
head();
if(count($domain)=3D=3Dcount($host))
{
if($base<>"")
{
wait_msg();
table_head();
if($dom=3D=3D"")
{
// Query all domains
for($i=3D0;$i<count($domain);$i++)
{
whois($base.$domain[$i],$host[$i]);
}
}
else
{
// Query specific domain
for($i=3D0;$i<count($domain);$i++)
{
if($domain[$i]=3D=3D$dom)
whois($base.$domain[$i],$host[$i]);
}
}
table_foot();
}
else
{
echo "<P ALIGN=3DCENTER><FONT FACE=3D\"Arial,Helvetica,Monaco\" =
SIZE=3D\"4\">\n";
echo "You need to enter a domain or basename<br>\n";
echo "</FONT></P>\n";
}
}
else
{
echo "<P ALIGN=3DCENTER><FONT FACE=3D\"Arial,Helvetica,Monaco\" =
SIZE=3D\"4\">\n";
echo "Error in script: Hosts count doesn't match domain count<br>\n";
echo "</FONT></P>\n";
}
foot();
?>
------=_NextPart_000_0042_01BFD154.6038B390--
php::bar PHP Wiki - Listenarchive