0

Hi all,

I need a php script that gets the IP address of a user entered website, something like this:

$site = 'www.google.com';

$ip = ping($site);

obviously replacing ping with a command that actually exists!

Thanks in advance.
MAX

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by MDGM
0

PHP comes with a fully functioning sockets API which you can find a tutorial for on Google. A function you could use is the 'gethostbyname()' function which accepts a hostname as a parameter and then returns that hosts IPv4 address.

See here for more information.

I hope this helps.
$witch3d.

Edited by switch3d: n/a

0

ahhh briliant, that should work perfectly. I dont have time to test it now but when I do ill mark the thread as solved.

Thanks again!
Max.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.