note 40200 deleted from function.gethostbyaddr by nlopess
| From: | nlopess@php.net | Date: | Wed, 25 Feb 2004 10:39:55 +0000 |
| Subject: | note 40200 deleted from function.gethostbyaddr by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65700@lists.php.net to get a copy of this message | ||
Note Submitter: luis.medinelli@terra.cl
----
/* An example for the use of gethostbyaddress() and gethostbyname(). The idea is a webpage for
answering the host or DNS name of any IP address and the IP address of any Host name or DNS. The
name of the file must be example.php */
<html>
<body>
<?php
echo "<b>Your IP is:</b> $REMOTE_ADDR<BR>";
?>
<form method='post' action="example.php">
Put any IP address <input type="text" name="ip" <?if ($ip=='')
echo "value=''"; else echo "value=$ip" ?>>
<input type=submit value=consulting>
</form><p>
<?
$name1=gethostbyaddr($ip);
if ($name1)
{
echo "The DNS name for <b>$ip</b> is <b>$name1</b>";
$name1="";
$name2="";
}
?><p>
<form method='post' action="example.php">
Put any DNS name <input type="text" name="host" <?if ($host=='')
echo "value=''"; else echo "value=$host" ?>>
<input type="submit" value=consulting>
</form><p>
<?
$name2=gethostbyname($host);
if ($name2)
{
echo "The IP address for <b>$host</b> is <b>$name2</b>";
$name1="";
$name2="";
}
?><p>
</body>
</html>