note 40200 added to function.gethostbyaddr
| From: | luis dot medinelli at terra dot cl | Date: | Wed, 25 Feb 2004 04:06:44 +0000 |
| Subject: | note 40200 added to function.gethostbyaddr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65682@lists.php.net to get a copy of this message | ||
/* 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>
----
Manual Page -- http://www.php.net/manual/en/function.gethostbyaddr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40200
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40200&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40200&report=yes
Search -- http://master.php.net/manage/user-notes.php