views:

135

answers:

3

Hey,

How do I get something in PHP/Curl to grab the IP of the URL for me? It's going to be a simple interface that fetches URL IP's back for me.

E.g. Enter "http://mysite.com" then I hit submit then I should get the IP of the mysite.com back.

Please show me how its done thanks.

+13  A: 

gethostbyname

$ip_string = gethostbyname( "stackoverflow.com" );
echo $ip_string; //returns ip address, ie 12.34.56.78
Kendall Hopkins
What about the simple interface linking? E.g. submit, enter ip.
Raymond
The function is limited to resolving IPv4 AFAIK.
Archimedix
What do you mean limited?
Raymond
This was not an answer to your original comment... It was a comment on `gethostbyname()`. See http://bugs.php.net/bug.php?id=49493.
Archimedix
+2  A: 

Try the gethostbyname function.

Stoosh
What about the simple interface linking? E.g. submit, enter ip.
Raymond
@Raymond: what about doing yourself?
zerkms
Zerkms ... +1 for late night amusement !
Stewie
A: 

addition to the gethostbyname comments above, here is your FORM ;) http://www.phpform.org/formbuilder/view.php?id=88a7d952adc5c043541975e275f3191b

Stewie