Getting user's IP address in LC Server
matthias_livecode_150811 at m-r-d.de
matthias_livecode_150811 at m-r-d.de
Tue May 4 03:48:39 EDT 2021
Hi Tim,
you can use the array variable $_SERVER for it. The variable contains the CGI interface related variables, along with any HTTP_* variables that are available.
$_SERVER["REMOTE_ADDR] contains the remote ip address.
Matthias
-
Matthias Rebbe
Life Is Too Short For Boring Code
> Am 04.05.2021 um 06:30 schrieb Tim Selander via use-livecode <use-livecode at lists.runrev.com>:
>
> Hi,
>
> I am trying to make a web page that changes content a bit based on the user's location. I am using my on-rev hosting account and am trying two different service's APIs:
>
> 1) put "My country is" && url "https://api.ipdata.co/country_name?api-key=my/key"
>
> 2) put "curl https://api.ipgeolocation.io/getip" into IPvariable
>
> But both of these return the info for Liquid Web LLC, the on-rev server company, not the info for me as I test the page in Tokyo.
>
> What is a reliable way to get the user's IP address and or geolocation info from LC Server?
>
> Any help appreciated!
>
> Thanks,
>
> Tim Selander
> Tokyo
>
> _______________________________________________
> 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