Geolocation via an API

This could be a really stupid question, but is there any way to use the results from a site like this that does not actually stipulate if they have an api or not?

https://www.geoplugin.com/quickstart

Well just use indeed their json service url as described in their docs:

http://www.geoplugin.net/json.gp?ip=xx.xx.xx.xx

Thanks so much @George

1 Like

And actually if you call the above without ip it will directly use the visitors ip :slight_smile: so you are all set!

http://www.geoplugin.net/json.gp

1 Like

How does it know to use the visitors ip without me telling it with a $_SERVER[‘REMOTE_ADDR’] just out of interest?

You are the visitor calling the service … duh… of course they see your ip

And the same happens if you put the call in the API data source a website. The visitors call it when they open the page

1 Like

Brilliant, thank you so much, going to get this working and report back as to exactly how it was done and results, thanks again.

1 Like

Sorry for the idiot question but. I get this response

a:24:{s:17:"geoplugin_request";s:12:"62.74.254.18";s:16:"geoplugin_status";i:200;s:15:"geoplugin_delay";s:3:"1ms";s:16:"geoplugin_credit";s:145:"Some of the returned data includes GeoLite data created by MaxMind, available from <a href=\'http://www.maxmind.com\'>http://www.maxmind.com</a>.";s:14:"geoplugin_city";s:6:"Athens";s:16:"geoplugin_region";s:6:"Attica";s:20:"geoplugin_regionCode";s:1:"I";s:20:"geoplugin_regionName";s:6:"Attica";s:18:"geoplugin_areaCode";s:0:"";s:17:"geoplugin_dmaCode";s:0:"";s:21:"geoplugin_countryCode";s:2:"GR";s:21:"geoplugin_countryName";s:6:"Greece";s:14:"geoplugin_inEU";i:1;s:19:"geoplugin_euVATrate";i:24;s:23:"geoplugin_continentCode";s:2:"EU";s:23:"geoplugin_continentName";s:6:"Europe";s:18:"geoplugin_latitude";s:7:"37.9833";s:19:"geoplugin_longitude";s:7:"23.7333";s:32:"geoplugin_locationAccuracyRadius";s:4:"1000";s:18:"geoplugin_timezone";s:13:"Europe/Athens";s:22:"geoplugin_currencyCode";s:3:"EUR";s:24:"geoplugin_currencySymbol";s:7:"&#8364;";s:29:"geoplugin_currencySymbol_UTF8";s:3:"€";s:27:"geoplugin_currencyConverter";s:6:"0.8748";}

How do I bind anything on the page. Tried all possible combinations but not displaying anything

I used the wrong url for a second - you need to use the one that returns json data:

http://www.geoplugin.net/json.gp

1 Like

WOW!!!
You must rename Wappler to LGWW
Life is good with Wappler

2 Likes

Did you get your working @t11

Mine sadly is not, it has nothing returned on the page online but i do get this error in my console

1 Like

Hi Paul,
The problem is you are trying to load an insecure resource http:// from a secure page https:// i.e. your page is https and the API url is http.

Ok I see. This service unfortunately starts charging as soon as you want to use https but it might be worth the fairly small price for me to be honest.

Just tested with HTTP rather and it just works, very clever indeed.

1 Like

Is there a way to use an onsuccess to say onsuccess of the first api load then load the second?

@psweb I think you can use “No Auto Load” option for second api.
First api loaded then you can load second api

That was exactly what i was hoping to do, my issue is that if i select my second api call and choose no auto load, then i would expect to select the first api call and add a new dynamic event of on success where i could then choose the second api as a load, but the option is not available.

@psweb Good catch :slight_smile: I will check quickly . I wondered