This was created because "REMOTE_HOST" environment variable does not always work.

Using Php

Your IP is : 54.159.94.253

Your Hostname is: ec2-54-159-94-253.compute-1.amazonaws.com

REMOTE_HOST =


Use the following php code to generate this:

$ip = getenv('REMOTE_ADDR');
$host = gethostbyaddr($ip);

Using Perl

Demo

Code