PHP : Convert Hostname to IP Address

host2ip.php

<html>
<head><title>Host to IP</title></head>
<body>
<h1>Host to IP </h1>
#created by rhoenix# <br/>
#29-08-2012# <br/> <br/>
<form method="POST">
Masukkan Host : <input type="text" name="host">
<input type="submit" value="cek">
</form>

<?php
$host = $_POST["host"];
    $ip = gethostbyname($host);
 
?>
Host :
<a href="<?php echo "http://".$host;?>" target="_blank"><?php echo $host;?></a> <br/>
IP :
<a href="<?php echo "http://".$ip;?>" target="_blank"><?php echo $ip;?></a>
</body>
</html>


Reference:
http://www.tuxradar.com/practicalphp/15/3/0

Comments

Popular posts from this blog

3 Tingkatan Cinta dan Berbagai Bentuk Cinta

Apa Itu Kaskus

Persamaan Harapan dan Cita cita