1
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.
1
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.
2
What you’re describing is a Reverse DNS Lookup.
In PHP you can use the function gethostbyaddr 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
?>
It is necessary to do a lookup on us DNS Records to obtain this information (A, CNAME, PTR and etc). For this there is the function dns_get_record:
<?php
echo var_dump(dns_get_record("google.com"));
?>
Very good, these tips will help a lot.
Browser other questions tagged php ip dns ping
You are not signed in. Login or sign up in order to post.
https://stackoverflow.com/questions/3621682/reverse-ip-find-domain-names-on-ip-address,
– MagicHat
@Magichat did not understand the reason for the negative, this question asked by him does not have in SOPT.
– Hiago Souza
@Hiagosouza is because you think I know the reason for the negativity, or you’re implying that I was the one who denied it?
– MagicHat
@Magichat is that I saw your comment so I thought it had been you, if it wasn’t forgiveness.
– Hiago Souza