Jannis: Einbindung einer Whois Abfrage in html

Beitrag lesen

Hallo! Ich hab mich mal umgeguckt, hab aber nix gefunden. Ich muss das folgende PHP Script in einer html oder als html datei aufrufen. Hab versucht das mit script tag zu machen geht aber nicht...

Könnt ihr mir helfen?

<?php

/**

  • This script enables you to start whois-querys.
  • @author  Wolfgang Drews drews@dynamicwebpages.de
  • @copyright GPL
  • some more whois-server (thanx to Bernhard Ostheimer):
  • Australia (whois.aunic.net)
  • Canada (whois.canet.ca)
  • Switzerland (whois.nic.ch)
  • edu,com,net,org,gov (whois.internic.net)
  • Spain (whois.eunet.es)
  • France (whois.nic.fr)
  • Italy (whois.nis.garr.it)
  • Japan (whois.nic.ad.jp)
  • South Korea (whois.nic.nm.kr)
  • Lichtenstein (whois.nic.li)
  • US Military (nic.ddn.mil)
  • Netherlands (domain-registry.nl)
  • Sweden (whois.internic.se)
  • Slovak Republic (whois.uakom.sk)
  • United Kingdom, not .ac.uk or .gov.uk (whois.nic.uk)
  • United States .us (nii-server.edu)
  • Assigned IP addresses (whois.arin.net)
  • Europe(whois.ripe.net)
  • Asia Pacific (whois.apnic.net) */

header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html> <head>              <style> <!--

h3 {  font-family: verdana, arial, "ms sans serif", sans-serif;  font-size: 16px;  margin: 10px;  line-height: 18px;  padding-left: 5px;  color: #e9f2fc;  } .small  {  font-family: verdana, arial, "ms sans serif", sans-serif;  font-size: 10px;  font-weight: normal;  padding-left: 10px;  line-height: 14px;  color: #e9f2fc;  }

.medium  {  font-family: verdana, arial, "ms sans serif", sans-serif;  font-size: 12px;  font-weight: normal;  line-height: 14px;  padding-left: 0px;  color: #e9f2fc;  }

.big  {  font-family: verdana, arial, "ms sans serif", sans-serif;  font-size: 14px;  line-height: 14px;  padding-left: 10px;  color: #e9f2fc;  }

a:link {  color: #333333;  font-weight: bold;  text-decoration: none;  } a:visited {  color: #333333;  font-weight: bold;  text-decoration: none;  } a:active {  color: #333333;  font-weight: bold;  text-decoration: none;  } a:hover {  color:#666666;  font-weight: bold;  text-decoration: overline;  } input, textarea, select {  background-color: #eeeeee;  font-family: verdana, arial, sans-serif;  font-size: 10px;  color: #333;  padding: 0px; }

.copyright  {  font-family: verdana, arial, "ms sans serif", sans-serif;  font-size: 10px;  font-weight: normal;  line-height: 10px;  padding-left: 5px;  color: #7C8AA4;  } -->

</style>

<title>Domainabfrage</title>

<?php

// Kontrolle, ob $submit gesetzt ist oder nicht. Wenn ja, dann gehts ins Programm, andernfalls // gehts unten beim Aufbau der Form weiter.

// Ist das Flag $submit gesetzt oder nicht? // -> isset : Einstieg in die Programmausfuerhung // -> !isset: html-Interface wird angezeigt.

if (isset($submit)) {  // Pruefe angegebene Domainendung  switch ($endfix)  {   case '.de':  $id=1; break;   case '.com': $id=2; break;   case '.net': $id=3; break;   case '.org': $id=4; break;   case '.lu':  $id=5; break;   default: echo("Fehler !\n"); break;  }

// setze String $domain zusammen  $domain=($domainname."".$endfix."");  // gewaehlten server abfragen  if ($id == 1)  {   $WhoIsServer="whois.ripe.net"; //$WhoIsServer zuweisen   $fp = fsockopen ("$WhoIsServer", 43, $errnr, $errstr); // Verbindung aufmachen      set_socket_blocking($fp,0);      fputs($fp, "$domain\n"); //Domain uebermittlen

// Antwort einlesen   while (!feof($fp))   {    $result = fgets($fp, 2048);          if (substr("$result" ,2, 16) == "No entries found")    { //result: frei     echo "       <p></p>

<table border=0 width=640><tr><td>

<font face='verdana' size='2' color='#4E566B'>

<b>Die von Ihnen abgefrage Domain $domain ist noch frei! <p></a></p></b>                                         <a href='http://www.netzkreationen.de/index.php?option=displaypage&Itemid=53&op=page&SubMenu='>Bestellen Sie ihre Domain jetzt!</a>       </font></td>                         </tr></table><br><br><br><br><br>";    }

else if (substr("$result" ,0, 7) == "domain:")    { //result: nicht frei     echo "                 <p></p><table border=0 width=640><tr><td>       <font face='verdana' size='2' color='#4E566B'>       <b>Die von Ihnen abgefrage Domain $domain ist leider schon vergeben.</b>       </font><br><br><font face='verdana' size='2' color='#4E566B'>       <b>Möchten Sie die technischen Daten der Domain sehen?       <a href='$PHP_SELF?actio=show&WhoIsServer=$WhoIsServer&domain=$domain' target='_self'>JA</a>       / <a href='#' target='_self'>NEIN</a>       </b></font><br><br></td></tr></table><br><br><br><br><br>";       } // Wenn nicht mehr frei Daten ansehen?        }      fclose($fp); // Verbindung schliessen  }

else if ($id==5)  {   $WhoIsServer="whois.restena.lu";   $fp = fsockopen ("$WhoIsServer", 43, $errnr, $errstr);      set_socket_blocking($fp, 0);      fputs($fp, "$domain\n");

while (!feof($fp))   {    $result = fgets($fp, 2048);          if (substr("$result" ,2, 16) == "No entries found")    {     echo "<p></p><table border=0 width=640><tr><td>       <font face='verdana' size='2' color='#4E566B'>                          <b>Die von Ihnen abgefrage Domain $domain ist noch frei! <p></a></p></b>                                         <a href='http://web75.a136.webplus24.de/buero/index.php?option=displaypage&Itemid=53&op=page&SubMenu='>Bestellen Sie ihre Domain jetzt!</a>       </font></td></tr></table><br><br><br><br><br>";    }          else if (substr("$result" ,0, 11) == "domainname:")    {     echo "<table border=0 width=640><tr><td>       <font face='verdana' size='2' color='#4E566B'>       <b>Die von Ihnen abgefrage Domain $domain ist leider schon vergeben.</b></font>       <br><br><font face='verdana' size='2' color='#4E566B'>       <b>Möchten Sie die technischen Daten der Domain sehen?       <a href='$PHP_SELF?actio=show&WhoIsServer=$WhoIsServer&domain=$domain' target='_self'>JA</a>       / <a href='#' target='_self'>NEIN</a></b></font><br><br></td></tr>       </table><br><br><br><br><br>";             }   }      fclose($fp);  }

else if ( $id == 2 || 3 || 4)  {   $fp = fsockopen("whois.crsnic.net", 43, $errno, $errstr);      set_socket_blocking($fp, 0);      fputs($fp, "$domain\n");

while (!feof($fp))   {       $result = trim(fgets($fp, 2048));       if (substr($result,0, 8) == "No match")    {     echo "<p></p><table border=0 width=640><tr><td>       <font face='verdana' size='2' color='#4E566B'>

<b>Die von Ihnen abgefrage Domain $domain ist noch frei! <p></a></p></b>                                         <a href='http://web75.a136.webplus24.de/buero/index.php?option=displaypage&Itemid=53&op=page&SubMenu='>Bestellen Sie ihre Domain jetzt!</a>       </td></tr></table><br><br><br><br><br>";    }          else if (substr($result, 0, 13) == "Whois Server:")    {     $WhoIsServer = trim(ereg_replace("Whois Server:"," ",$result));                 echo "<table border=0 width=640><tr><td>       <font face='verdana' size='2' color='#4E566B'>       <b>Die von Ihnen abgefrage Domain $domain ist leider schon vergeben.</b>       </font><br><br><font face='verdana' size='2' color='#4E566B'>       <b>Möchten Sie die technischen Daten der Domain sehen?       <a href='$PHP_SELF?actio=show&WhoIsServer=$WhoIsServer&domain=$domain' target='_self'>JA</a>       / <a href='#' target='_self'>NEIN</a> </b></font><br><br>       </td></tr></table><br><br><br><br><br>";    }   }      fclose($fp);     } }

//DomainDaten abfragen

function showtime($domain, $WhoIsServer) {  if ( (empty($domain) == false) && (empty($WhoIsServer) == false))  {   $fps = fsockopen ("$WhoIsServer", 43, $errno, $errstr)    or die("Fehler beim Verbindungsaufbau zum Whois-Server.\n");   set_socket_blocking($fps, 0);   fputs($fps, "$domain\n");      echo "<table border=1 width=640><tr><td><PRE>";

while (!feof($fps))   {    $result = fgets($fps, 2048);             echo "$result";         }         echo "</td></tr></table></PRE>";   fclose($fps);  }  else echo "Nicht alle notwendigen Daten konnten ermittelt werden.\n"; }

//Sollen DomainDaten angezeigt werden?

if($actio) {  switch ($actio)  {   case show:       showtime($domain, $WhoIsServer);       break;      default:    echo ("Fehler in Switch!");       break;     } } ?>

</head> <body>

<!--- WhoIs Html-Interface Start---> <p></p> <p></p> <p></p> <p></p> <img src="http://web195.a130.webplus24.de/whois.jpg" width="178" height="80" alt="Bilder werden geladen..." border=0>

<p></p>   <p></p>   <br> <table border="0" width="640"> <form action="<?php echo $PHP_SELF ?>" method="POST" target="_self"> <tr>  <td width="130" valign="top" align="left">   <font face="Verdana" size="2" color="#4E566B"><b>Domainüberprüfung:</b></font>  </td>  <td width="283" valign="top" align="left">   <font face="Verdana" size="2" color="#4E566B">   <b>www. <input type="text" name="domainname" size="17">      <select name="endfix" size="1"     style="font-family: Verdana; font-size: 10pt; color: #4E566B; font-weight: bold">    <option name="de" value=".de">.de    <option name="com" value=".com">.com    <option name="net" value=".net">.net    <option name="org" value=".org">.org   </select>   </b></font>  <td width="88" valign="top" align="left">   <font face="Verdana" size="2" color="#4E566B"><b>   <input type="submit" name="submit" value="Suchen"    style="font-family: Verdana; font-size: 10pt; color: #4E566B; font-weight: bold">   </b></font>  </td>  <td width="121" valign="top" align="left">   <font face="Verdana" size="2" color="#4E566B"><b>   <input type="reset" value="löschen"    style="font-family: Verdana; font-size: 10pt; color: #4E566B; font-weight: bold">   </b></font>  </td> </tr> <tr>  <td width="164" valign="top" align="left"></td>  <td width="209" valign="top" align="left"></td>  <td width="88" valign="top" align="left"></td>  <td width="121" valign="top" align="left"></td> </tr> <tr>  <td width="164" valign="top" align="left"> </td>  <td width="209" valign="top" align="left"></td>  <td width="88" valign="top" align="left"></td>  <td width="121" valign="top" align="left"></td> </tr> </form> </table>      <br> <!--- WHOIS Html-Interface Ende --->

</body> </html>