PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How to find a domain name for an IP address?


If you have an IP address then sometimes it will be useful to try to resolve the host domain name for that IP address.

To do this is easy in PHP as there is a built in function that accepts the IP address and will find the host name for you.

In order to do this, code like the below will help:

<?php
$ip 
$REMOTE_ADDR;//capture IP
$domain GetHostByName($ip);
?>


The variable $domain will now contain the hostname.



More website PHP Questions

How do I display todays date on my website?
How do I find a visitors IP address?
How do I send HTTP headers with PHP?
How do I perform a 301 redirect with PHP?
How do I make sure an include file exists before loading the page?