Asheeown Posted August 29, 2009 Share Posted August 29, 2009 I have a list of sites in this form: www.example.com Now, obvious to start with gethostbyname() right? Well all it returns is the hostname right back. $ip = gethostbyname($x); echo "$x - $ip<br>"; Something I'm doing wrong here? Link to comment https://forums.phpfreaks.com/topic/172344-ip-from-hostname/ Share on other sites More sharing options...
oni-kun Posted August 29, 2009 Share Posted August 29, 2009 I'd recommend just trying this code to see if it works on your server to test if everything is working alright. Your server's DNS may be malfunctioning or the website.. physically.. example.com may not have a corresponding IP that can be parsed. $ip = gethostbyname('www.google.com'); //Returns 74.125.127.104 for me. echo $ip; Link to comment https://forums.phpfreaks.com/topic/172344-ip-from-hostname/#findComment-908724 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.