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? Quote 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; Quote Link to comment https://forums.phpfreaks.com/topic/172344-ip-from-hostname/#findComment-908724 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.