• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 461
  • Last Modified:

Very Simple PHP Question

When I go to IPCHICKEN.com it displays my IP: 69.3.28.xxx . It also displays this: h-69-3-28-xxx.snvacaid.dynamic.covad.net . IPCHICKEN refers to that as the "name address." I've seen many sites do the same thing and display the "name adress."

MY QUESTION IS: How do u display the "name address" in PHP.

BTW, I already know how to display the IP: $_SERVER["REMOTE_ADDR"]. Could u tell me how to display the name adress in this format, if it is possible.
1 Solution
You need to feed the gethostbyaddr() function the IP address eg:

$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo $hostname;
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now