How to get the IP address from "http: //" or "www" in PHP?

How do I get something in PHP / Curl to grab the IP address of a url for me? This will be a simple interface that returns a url url for me.

eg. Go to "http://mysite.com", then I click "Submit", then I have to return the IP address of mysite.com.

+4
source share
2 answers

gethostbyname

 $ip_string = gethostbyname( "stackoverflow.com" ); echo $ip_string; //returns ip address, ie 12.34.56.78 
+14
source
+3
source

All Articles