gethostbyaddr(),gethostbyname() functions:

gethostbyaddr(),gethostbyname() functions:

gethostbyname() :string gethostbyname ( string hostname) — Returns the IP address of the Internet host specified by hostname.

string gethostbyname ( string hostname) — Returns the IP address of the Internet host specified by .Example :

<?php

echo $ip = gethostbyname(”localhost”); // will give ip address of the internet host

$iplist = gethostbynamel(”localhost”);

// will give the list of ip addresses corresponding to the given internet host

print_r($iplist);

?>

gethostbyaddr() :gethostbyaddr — Get the Internet host name corresponding to a given IP address

gethostbyaddr — Get the Internet host name corresponding to a given IP addressExample :

<?php

$hostname = gethostbyaddr($_SERVER[’REMOTE_ADDR’]);

echo $hostname;

?>

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.