Page 4 of 4

Re: Operating system code test request...

Posted: Wed May 26, 2021 11:29 pm
by kdjanz
Using the api URL, the information is much more accurate for me - like 35 km closer and the right postal code. So I would use the api URL - all else being equal (which it never is).

Re: Operating system code test request...

Posted: Thu May 27, 2021 10:36 am
by bogs
Certainly a reasonable way to go, under the results of this test so far.

Re: Operating system code test request...

Posted: Thu May 27, 2021 12:51 pm
by AxWald
Hi,
bogs wrote: Wed May 26, 2021 10:22 pm I don't have a win10 box to test on anymore, so maybe I'll put a disclaimer on it that Windows results may be "iffy" hee hee.
Win 10-64 pro (21H1), LC 6.7.10 & 9.6.2 rc3 both:

Code: Select all

put shell("curl ipinfo.io")
gives the info as mentioned by others, location is about 10km off.

Code: Select all

put shell("curl ipinfo.io/json")
gives the same result as above.

Code: Select all

put shell("curl api.infoip.io")
gives the info in another format, and a different location. Still far off, but a little less (~8km).

I'm just outside the city limits of a big city (where the ISP resides, too), in Bavaria. The shown locations are the dead center of the city (for ipinfo.io*) and roughly the area where the ISP is located (api.infoip.io).

All results start with sort of a header "% Total % Received ...", then some lines with numbers or empty, finally a JSON. "ipinfo" returns its JSON with line breaks, "infoIP" on one line. Simple enough to get the data.

Have fun!

Re: Operating system code test request...

Posted: Thu May 27, 2021 1:44 pm
by bogs
Yes, but I think SparkOut wasn't using curl, just (get / put). I also (possibly incorrectly) assume he is on Win 10, I don't know for sure.

So on my system, 'Nix, Lc 6.5.2 (predominantly for this test), using just Lc put url gives me a single line return if I use

Code: Select all

put url ("http://api.infoip.io/")
It is easy enough to change that to multiple lines simply by substituting commas for returns -

Code: Select all

put url ("http://api.infoip.io/") into tVar; replace "," with cr in tVar; put tVar
Richard's post with json instead of api returns it in already lined format here -

Code: Select all

put url "http://ipinfo.io/json"
I'm also not exactly sure when people started switching the address, but at least I figured out why one format seems more accurate than the other, it is because they are 2 different addresses, not because one is json and one is api drawn.

In my original post, I was using ipinfo.io. SparkOut's first post used infoip LOL, so I guess he is to blame for that but, I'll give him credit for using a more accurate IP locating site :twisted:

Using just -

Code: Select all

put url "http://api.infoip.io/"
Seems to work just fine, gives you a single line return, etc. and probably is as accurate as anything else.

Re: Operating system code test request...

Posted: Thu May 27, 2021 2:17 pm
by dunbarx
Bogs.

Just got a bit into this thread today. On a Mac desktop, I got data about 1 mile from my, er, desktop.

Craig

Re: Operating system code test request...

Posted: Thu May 27, 2021 2:35 pm
by bogs
Thanks Craig, but which of the two addresses were you using? Also OS vers. and Lc vers. would help a lot.

The two addresses for getting the location :
  1. "http://api.infoip.io/" -- so far, the more accurate one...
  2. "http://ipinfo.io/json" -- a bit less accurate...

Re: Operating system code test request...

Posted: Thu May 27, 2021 3:52 pm
by AxWald
Hi,

btw:

Code: Select all

   get url "http://api.infoip.io/"
works on Android, too :)

In my case (location disabled, not @ city central, so no known WIFIs) it returns the same quite far off location as on desktop.

Have fun!

Edit: Added location info

Re: Operating system code test request...

Posted: Thu May 27, 2021 3:57 pm
by bogs
Good to know :)

Re: Operating system code test request...

Posted: Sat May 29, 2021 9:10 am
by stam
80 miles off on my mac laptop... haven't tested on mobile.
Interesting (well, almost) discussions re: CURL/libURL/TsNet - if you're familiar with CURL it may seem like overkill, but the liveCode methods don't have a dependency on CURL being on the system if i understood correctly... good to know going forward...

Re: Operating system code test request...

Posted: Sat May 29, 2021 11:06 am
by bogs
Using which of the 2 addresses, stam?

Re: Operating system code test request...

Posted: Sat May 29, 2021 1:57 pm
by stam
bogs wrote: Sat May 29, 2021 11:06 am Using which of the 2 addresses, stam?
I live in London. put shell("curl ipinfo.io" ) puts my location in Kettering, a town 80 miles north of London.
I then tried put url ("http://api.infoip.io/") - this puts my location in Shepherd's Bush in London, but 8 miles from me.

hope that helps
Stam

Re: Operating system code test request...

Posted: Sat May 29, 2021 2:08 pm
by bogs
Sure does, info ip certainly is coming out the more accurate by far of the 2.