<div dir="ltr">Hi Michael,<div><br></div><div>Yes you're correct about $_SERVER['REMOTE_HOST'], but the issue is that because lookups are disabled, this comes back blank.<br></div><div><br></div><div>I'll give that gethostbyaddre() a try - it sounds like it'll work.</div><div><br></div><div>Thanks for your input.</div><div><br></div><div><br></div><div>DD</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 30, 2020 at 5:49 PM Michael Stauber <<a href="mailto:mstauber@blueonyx.it">mstauber@blueonyx.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Dick,<br>
<br>
> however I actually just want a single site’s PHP to be able to resolve IP addresses to a more human-readable form. <br>
<br>
I may not understand the problem at hand correctly, but PHP can easily<br>
tell you not only the IP of the connection, but also the hostname as<br>
reported by DNS.<br>
<br>
Sure "Host Name Lookups" must be enabled in Apache in order for the PHP<br>
environment variable 'REMOTE_HOST' to be set.<br>
<br>
But 'REMOTE_ADDR' is set anyway, so you have the IP. So you can just do<br>
an extra step like this ...<br>
<br>
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);<br>
<br>
... and you get the hostname.<br>
<br>
But as always the devil is in the details. You might want to configure<br>
DNS timeouts, if the visitor uses a web proxy you might need to use<br>
$_SERVER['HTTP_X_FORWARDED_FOR'] instead of $_SERVER['REMOTE_ADDR'] and<br>
you need error checks for the cases where that routine chokes because<br>
$_SERVER['REMOTE_ADDR'] reported more than one IP.<br>
<br>
-- <br>
With best regards<br>
<br>
Michael Stauber<br>
_______________________________________________<br>
Blueonyx mailing list<br>
<a href="mailto:Blueonyx@mail.blueonyx.it" target="_blank">Blueonyx@mail.blueonyx.it</a><br>
<a href="http://mail.blueonyx.it/mailman/listinfo/blueonyx" rel="noreferrer" target="_blank">http://mail.blueonyx.it/mailman/listinfo/blueonyx</a><br>
</blockquote></div>