When we ping a URL address type www.google.com the prompt returns us the IP 172.217.30.4, now I would like to know how to get the URL address only with the IP number through PHP, preferably. Thanks in advance for your understanding.
When we ping a URL address type www.google.com the prompt returns us the IP 172.217.30.4, now I would like to know how to get the URL address only with the IP number through PHP, preferably. Thanks in advance for your understanding.
What you are describing is a Reverse DNS Lookup .
In PHP you can use the gethostbyaddr function to resolve names through an ip. This does not mean that you will get the main domain from an ip.
<?php
echo gethostbyaddr("172.217.30.4"); // rio01s23-in-f4.1e100.net
?>
A lookup is required at DNS Records for this information (A, CNAME, PTR, and so on). For this there is the dns_get_record function:
<?php
echo var_dump(dns_get_record("google.com"));
?>