Find Ip From Hostname

Description: This often works better than using gethostbyname() or other native functions:

<?PHP
 
$ip = RTRIM(`/usr/bin/dig $host A +short | /usr/bin/tail -1`);
 
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.