Zend - The PHP Company




External

Add Code


nslookup v2.0  

Type: code fragment
Added by: _The_Crow_
Entered: 27/06/2000
Last modified: 08/12/1999
Rating: *** (7 votes)
Views: 10593
Simply nslookup to use in PHP. Now in version 2.0 you can get the IP address corresponding to a given Internet host name and get the Internet host name corresponding to a given IP address.


<html>
<head>
<title>.: n s l o o k u p :.</title>

<style>
a:link {text-decoration: none}
a:visited {text-decoration: none}
a:hover {text-decoration: underline}
</style>

</head>

<body bgcolor="#E2E2E2" text="#000000" topmargin="0" leftmargin="0" link="#000000" vlink="#000000" alink="#000000">

<?
$nslookup_version 
"nslookup v2.0 - Running on PHP ".phpversion();
?><br>
<table border="1" width="100%" cellspacing="0" bordercolor="#000000">
  <tr>
    <td width="100%" bgcolor="#CCCCCC"><font face="Verdana,Arial" size="1"><b> &nbsp;<? echo $nslookup_version ?>  </b></font></td>
  </tr>
</table>
<table border="1" width="100%" cellspacing="0" cellpadding="4" bordercolor="#000000">
  <tr>
    <td width="100%" bgcolor="#000000">
      <p align="center"><b><font face="Verdana,Arial" size="4" color="#00FF00">_______________</font></b><b><font face="Verdana,Arial" size="4" color="#00FF00">|</font><font face="Verdana,Arial" color="#FFFFFF" size="4">
      n s l o o k u p </font><font face="Verdana,Arial" size="4" color="#00FF00">|</font></b><b><font face="Verdana,Arial" size="4" color="#00FF00">_______________</font></b></td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#C8C8C8">
      <div align="center">
        <center>
        <table border="0" width="600" cellspacing="0" cellpadding="0">
          <tr>
            <td width="100%" align="center">
             <form name=nslookup method=post action=nslookup.php>
             <b>
             <font face="Verdana,Arial" size="2">
              <br>
             <select size="1" name="IPorNAME">
              <option value="namex">Host Name</option>
              <option value="ipx">IP Address</option>
             </select> </font><font face="Verdana,Arial" size="3">: </font><font face="Verdana,Arial" size="2"><input type=text name=ipnamex size=15 maxlength=100><input type=submit value=Go!>
              <br>
              <br>
              <?
                
if(!empty($ipnamex))
         {
                if (
$IPorNAME == ipx)
         {
                  echo (
"Official Name: ");
                  echo (
"</b>");
                  echo 
gethostbyaddr($ipnamex);
                  echo (
"<br><b>");
                  echo (
"IP address: ");
                  echo (
"</b>");
                  echo 
$ipnamex;
         }
              elseif (
$IPorNAME == namex)
                 {
                  echo (
"Official Name: ");
                  echo (
"</b>");
                  echo 
$ipnamex;
                  echo (
"<br><b>");
                  echo (
"IP address: ");
                  echo (
"</b>");
                  echo 
gethostbyname($ipnamex);
                 }
                 }
              
?>
             </font>
             </form>
            </td>
          </tr>
        </table>
        </center>
      </div>
    </td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#000000">
      <p align="center"><b><font face="Verdana,Arial" size="3" color="#00FF00">.:..::.
      .: :. .. . :: : :. . . :: : :. :: :: :: .. . : : :: : .: :&nbsp; :: : : ..
      :. ::. . . :: : :: . . : : .</font></b></td>
  </tr>
</table>
<table border="1" width="100%" cellspacing="0" bordercolor="#000000">
  <tr>
    <td width="100%" align="right" bgcolor="#CCCCCC"><font face="Verdana,Arial" size="1">made by
      <a href="mailto:thecrow@impulsive.org">
      |The-Crow|</a> @ Jun 2000</font></td>
  </tr>
</table>

</body>
</html>


Usage Example


See the example


Rate This Script





Search



This Category All Categories