Getting Remote Host

I created a shopping cart for use with PayPal Express Checkout and I want to collect the customer’s connection information. System.EnvironmentVariable(REMOTE_HOST) is rather erratic in that sometimes it’s there and sometimes it isn’t and I don’t know if that’s a server issue or an issue with the web app. I can get the remote host reliably with php using gethostbyaddr($addr) but I haven’t figured out a way to get that value into a variable in the web app. Any ideas, advice or suggestions would be appreciated.

http://documentation.xojo.com/index.php/WebSession.RemoteAddress

The IP address is not a problem, System.EnvironmentVariable(REMOTE_ADDR) is always valid. The problem is that REMOTE_HOST is missing more often than not and I haven’t yet found an effective way to do a hostname lookup within a web app.

The missing web host issue is not a Xojo problem. My 10 years experience with Perl and PHP is simply that it is not always available. You may want to simply use IP which is always there.

What do you get if you use command: nslookup IP-address.

Sometimes there are no hostname assigned to the ip-address.

[quote=63141:@John Hansen]What do you get if you use command: nslookup IP-address.

Sometimes there are no hostname assigned to the ip-address.[/quote]
I can get the remote hostname using the shell but I have it disabled on the site because I don’t need it with the other admin tools I have and I don’t want the additional security risk of having that service available on the site. I’d rather do the host lookup through the web app using an embedded script when it isn’t available in the environment variables if I can find a way to read the response into a variable.

I’m testing from a resolved host, and my hostname resolves in my php script even when it isn’t present in the environment variables. I’ve also discovered that QueryString appears and disappears rather erratically from the environment variables as well, even when the query string is visible in the browser address field. I have to use URLParameter to read in the query string reliably, but the remote hostname is not available as a URL parameter.

You could file a feature request. :slight_smile: