Getting the Public IP address
Matthias Rebbe
matthias_livecode_150811 at m-r-d.de
Thu Aug 8 11:02:33 EDT 2013
I created a php file with the following code and put it on my server.
<?php if ($_SERVER["HTTP_X_FORWARDED_FOR"] != "") {
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$proxy = $_SERVER["REMOTE_ADDR"];
$host = @gethostbyaddr($_SERVER["HTTP_X_FORWARDED_FOR"]);
} else {
$IP = $_SERVER["REMOTE_ADDR"];
$host = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
}
echo $IP;
?>
In my livecode app i am calling that php file with
get URL "http://myserver.com/my php-file.php"
to get the ip then.
Regards,
Matthias
Am 08.08.2013 um 12:30 schrieb FlexibleLearning.com <admin at FlexibleLearning.com>:
> I am trying to establish the User's public IP address. The Scripter's
> Scrapbook has several methods, all of which return the same result and all
> of which seem to return a local IP address (e.g. put the hostnametoaddress
> of the hostname into myIP). I am getting 192.168.2.2 (local) instead of the
> required 85.210.89.23 (public). It must be possible as a google search on
> 'My IP address' displays it.
>
> As a self-confessed die-hard IP nitwit, I have tried to research a solution
> but have failed miserably.
>
> Has anyone got a method to obtain a User's public IP address?
>
> Many thanks,
>
> Hugh Senior
> FLCo
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list