Operating system code test request...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Operating system code test request...
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...
Certainly a reasonable way to go, under the results of this test so far.
Re: Operating system code test request...
Hi,
gives the info as mentioned by others, location is about 10km off.
gives the same result as above.
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!
Win 10-64 pro (21H1), LC 6.7.10 & 9.6.2 rc3 both:
Code: Select all
put shell("curl ipinfo.io")
Code: Select all
put shell("curl ipinfo.io/json")
Code: Select all
put shell("curl api.infoip.io")
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!
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!
Re: Operating system code test request...
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
It is easy enough to change that to multiple lines simply by substituting commas for returns -
Richard's post with json instead of api returns it in already lined format here -
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
Using just -
Seems to work just fine, gives you a single line return, etc. and probably is as accurate as anything else.
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/")
Code: Select all
put url ("http://api.infoip.io/") into tVar; replace "," with cr in tVar; put tVar
Code: Select all
put url "http://ipinfo.io/json"
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
Using just -
Code: Select all
put url "http://api.infoip.io/"
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Operating system code test request...
Bogs.
Just got a bit into this thread today. On a Mac desktop, I got data about 1 mile from my, er, desktop.
Craig
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...
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 :
The two addresses for getting the location :
- "http://api.infoip.io/" -- so far, the more accurate one...
- "http://ipinfo.io/json" -- a bit less accurate...
Re: Operating system code test request...
Hi,
btw:
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
btw:
Code: Select all
get url "http://api.infoip.io/"
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!
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!
Re: Operating system code test request...
Good to know
Re: Operating system code test request...
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...
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...
Using which of the 2 addresses, stam?
Re: Operating system code test request...
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...
Sure does, info ip certainly is coming out the more accurate by far of the 2.