ajetrumpet Posted February 19, 2021 Share Posted February 19, 2021 can someone explain to me why PHP returns so many different variants when throwing out visitor info using this piece of code? $ip = gethostbyaddr($_SERVER['REMOTE_ADDR']); here are some examples I have seen recently: planetlab24.gino-research.net.in.tum.de 10.32.64.124 49.129.197.35.bc.googleusercontent.com abts-north-dynamic-142.110.68.182.airtelbroadband.in 173-20-152-84.client.mchsi.com now, obviously i can understand the google one, and a few others. but, given the info and insight on these pages: https://www.php.net/manual/en/function.gethostbyaddr.php , and https://www.php.net/reserved.variables.server , why are the returns so different for different people? why does PHP see all different kinds of things? is the cause the way the user’s server is configured? some identifying info OF the server? and what about reserved IPs? like the “10.xx…” one I listed above? I’ve seen hundreds from that pool, and other blocks of reserved ones, and they have never had alpha-chars included in their captures. it’s always only the IP numbers. there a reason for that? really, all I’m looking for is why I see what I see. anyone help? furthermore, does anyone know if other server-side languages like c#, python, ruby or any js frameworks return different results than PHP ever would? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/312180-different-types-of-returns-using-gethostbyaddr-and-remote_addr/ Share on other sites More sharing options...
requinix Posted February 19, 2021 Share Posted February 19, 2021 You know how DNS can turn a name like forums.phpfreaks.com into an IP address like 199.119.180.53? And how if the DNS isn't setup then you can't get to the website? Similar thing for turning IP addresses into names. Sometimes they're configured, sometimes they're not. Nothing you can do about it. Quote Link to comment https://forums.phpfreaks.com/topic/312180-different-types-of-returns-using-gethostbyaddr-and-remote_addr/#findComment-1584624 Share on other sites More sharing options...
ajetrumpet Posted February 19, 2021 Author Share Posted February 19, 2021 OK, so the answer to my question is that it's the fault of DNS configurations by whatever they are using as a host/server resource? if that's the case, that's all I need to know. Quote Link to comment https://forums.phpfreaks.com/topic/312180-different-types-of-returns-using-gethostbyaddr-and-remote_addr/#findComment-1584626 Share on other sites More sharing options...
kicken Posted February 19, 2021 Share Posted February 19, 2021 More or less. A reverse DNS entry (IP to Name) is not required so it may or may not exist for any given IP. If it does exist, the IP owner can make it whatever they want it to be. For the majority of IPs the reverse entry is controlled by the host or ISP. An ISP will generally either not have a reverse entry or it will be something dynamically generated. A hosting service will generally be similar to an ISP, but some do allow the end-user to control the reverse entry if they have a dedicated IP. With the ubiquity of shared hosting these days though the reverse generally just is something generic rather than mapping to a domain similar to a forward lookup mapping to an ip. Quote Link to comment https://forums.phpfreaks.com/topic/312180-different-types-of-returns-using-gethostbyaddr-and-remote_addr/#findComment-1584628 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.