-3

I need to get the IP address of a domain by the domain name.

  1. Site: hotmail.com / 65.55.72.151
  2. Site: domain.com / 65.254.244.180

Can it be done, and in that case, how can I do it?

7
  • 5
    Use gethostbyname :)
    – gen_Eric
    Mar 14, 2013 at 16:35
  • Who eat up the code from between the tags ? :p
    – Rikesh
    Mar 14, 2013 at 16:36
  • i want it using php ? - Rocket Hazmat
    – Hadidi44
    Mar 14, 2013 at 16:36
  • Rikesh - by mistake :P
    – Hadidi44
    Mar 14, 2013 at 16:38
  • Hadidi44: use the @-form to call someone, e.g. @Rikesh. You can edit your own question and put the code back in. Mar 14, 2013 at 16:42

1 Answer 1

9

You can use this code:

<?php
$ip = gethostbyname('www.site.com');

echo $ip;
?>

Or, you could operate it dynamically...

<?php
$url = $_GET['url'];
$ip = gethostbyname($url);

echo $ip;
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.