Operating system code test request...

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Operating system code test request...

Post by kdjanz » Wed May 26, 2021 11:29 pm

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).

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Operating system code test request...

Post by bogs » Thu May 27, 2021 10:36 am

Certainly a reasonable way to go, under the results of this test so far.
Image

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Operating system code test request...

Post by AxWald » Thu May 27, 2021 12:51 pm

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!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Operating system code test request...

Post by bogs » Thu May 27, 2021 1:44 pm

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.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Operating system code test request...

Post by dunbarx » Thu May 27, 2021 2:17 pm

Bogs.

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

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Operating system code test request...

Post by bogs » Thu May 27, 2021 2:35 pm

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...
Image

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Operating system code test request...

Post by AxWald » Thu May 27, 2021 3:52 pm

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
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Operating system code test request...

Post by bogs » Thu May 27, 2021 3:57 pm

Good to know :)
Image

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Operating system code test request...

Post by stam » Sat May 29, 2021 9:10 am

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...

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Operating system code test request...

Post by bogs » Sat May 29, 2021 11:06 am

Using which of the 2 addresses, stam?
Image

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Operating system code test request...

Post by stam » Sat May 29, 2021 1:57 pm

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

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Operating system code test request...

Post by bogs » Sat May 29, 2021 2:08 pm

Sure does, info ip certainly is coming out the more accurate by far of the 2.
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”