This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
In this article, you will learn how to get the IP address of a website in PHP.
Let’s say you want to find out the IP address of Codesource.io’s website. You need to know the URL, which is codesource.io
Get IP Address Of Website in PHP
In order to get the IP address of a website, you can use the gethostbyname()
method.
// Get IP address of a URL
$ip_address = gethostbyname("codesource.io");
// Display the IP address
echo "IP Address of codesource.io is ".$ip_address;
// IP Address of codesource.io is 172.67.153.44
Note: The gethostbyname()
method functions by returning the IPV4 address of the supplied URL or hostname.
The post How to Get IP Address Of Website in PHP appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
Ariessa Norramli | Sciencx (2021-03-01T12:38:36+00:00) How to Get IP Address Of Website in PHP. Retrieved from https://www.scien.cx/2021/03/01/how-to-get-ip-address-of-website-in-php/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.