nekudocom / shiny_geoip Goto Github PK
View Code? Open in Web Editor NEWIP to location API service
License: MIT License
IP to location API service
License: MIT License
Hello. I recently deployed this project to my server and I wanted to add the ability to support both the city and ASN databases to allow for ISP and ASN queries. I tested by swapping out the database location in src/Domain/LocationDomain.php for the ASN database and the ASN database successfully allowed it to display ASN/ISP queries. However, I wanted to find a way to allow both the city records and asn records to be processed. Is there any way I could go about doing this without completely modifying the project past its original form? Thanks.
I am using Shiny GeoIP Tag 1.
followed the steps as provided in readme.
Installed and running correctly. Showing default 'Free IP GeoLocation/GeoIp API' homepage with no geoIP information.
I also tried using grabing information via js ajax callback, still retrieving default homepage instead of JSON data with no location information.
Please Help.
Hey,
I am not php developer ...:(
I can't setup the site to work for me , I have set the rewrite in the iis like this
<rewrite>
<rules>
<rule name="GeoIp">
<match url=".*" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
but when I try to access the url :http://mydomain/api/87.79.99.25
I am getting the message : ":( Page not found."
and url have some loop till the max chars end like this : /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/api/87.79.99.25
I have tried to play with the url rewrite with no success :-(
the second thing I want to verify is the DB download file(GeoLite2-Country.mmdb) suppose to be paste to data folder as is or do I need to build it somehow
Thanks
Hello,
After install i'm getting :
Error
A website error has occurred. The website administrator has been notified of the issue. Sorry for the temporary inconvenience.
When I request http://geoip.nekudo.com/api/127.0.0.1 then I get an error which is correct, but the http status is 200. The http status should be 404.
I tried to use your service by jsonp request and if your service not found ip then it answers not jsonp format.
Try this http://geoip.nekudo.com/api/10.0.97.3?callback=d3.jsonp.KHTmQBEaORpDfkA
Can you fix it, please?
Thanks!
Your migration to PHP7 is not backwards compatible with previous versions of PHP for instance line 80 gives a fatal error now. Perhaps there should be two different branches?
There is probably nothing wrong, and I'm probably just confused when reading the docs.
It seems like https://geoip.nekudo.com/api/87.79.99.25/en/full returns more than English (when all I wanted was English, and I seem to need to specify "full" because I want to see the US state / subdivision):
{
"city": {
"geoname_id": 2886242,
"names": {
"de": "K\\u00f6ln",
"en": "Cologne",
"es": "Colonia",
"fr": "Cologne",
"ja": "\\u30b1\\u30eb\\u30f3",
"pt-BR": "Col\\u00f4nia",
"ru": "\\u041a\\u0451\\u043b\\u044c\\u043d",
"zh-CN": "\\u79d1\\u9686"
}
},
"continent": {
"code": "EU",
"geoname_id": 6255148,
"names": {
"de": "Europa",
"en": "Europe",
"es": "Europa",
"fr": "Europe",
"ja": "\\u30e8\\u30fc\\u30ed\\u30c3\\u30d1",
"pt-BR": "Europa",
"ru": "\\u0415\\u0432\\u0440\\u043e\\u043f\\u0430",
"zh-CN": "\\u6b27\\u6d32"
}
},
"country": {
"geoname_id": 2921044,
"is_in_european_union": true,
"iso_code": "DE",
"names": {
"de": "Deutschland",
"en": "Germany",
"es": "Alemania",
"fr": "Allemagne",
"ja": "\\u30c9\\u30a4\\u30c4\\u9023\\u90a6\\u5171\\u548c\\u56fd",
"pt-BR": "Alemanha",
"ru": "\\u0413\\u0435\\u0440\\u043c\\u0430\\u043d\\u0438\\u044f",
"zh-CN": "\\u5fb7\\u56fd"
}
},
"location": {
"accuracy_radius": 10,
"latitude": 50.9387,
"longitude": 6.9547,
"time_zone": "Europe\\/Berlin"
},
"postal": {
"code": "50667"
},
"registered_country": {
"geoname_id": 2921044,
"is_in_european_union": true,
"iso_code": "DE",
"names": {
"de": "Deutschland",
"en": "Germany",
"es": "Alemania",
"fr": "Allemagne",
"ja": "\\u30c9\\u30a4\\u30c4\\u9023\\u90a6\\u5171\\u548c\\u56fd",
"pt-BR": "Alemanha",
"ru": "\\u0413\\u0435\\u0440\\u043c\\u0430\\u043d\\u0438\\u044f",
"zh-CN": "\\u5fb7\\u56fd"
}
},
"subdivisions": [
{
"geoname_id": 2861876,
"iso_code": "NW",
"names": {
"de": "Nordrhein-Westfalen",
"en": "North Rhine-Westphalia",
"es": "Renania del Norte-Westfalia",
"fr": "Rh\\u00e9nanie du Nord-Westphalie",
"ru": "\\u0421\\u0435\\u0432\\u0435\\u0440\\u043d\\u044b\\u0439 \\u0420\\u0435\\u0439\\u043d-\\u0412\\u0435\\u0441\\u0442\\u0444\\u0430\\u043b\\u0438\\u044f"
}
}
],
"traits": {
"ip_address": "87.79.99.25"
}
}
Maybe I'm misunderstanding the instructions for: language | optional | Two character language code like en or de.
What would be really cool would be allowing optional GET params such as like this:
https://geoip.nekudo.com/api/?lang=en&type=full&ip=87.79.99.25
This way, we can omit the IP (so that it can be autodetected) yet still specify the language and type.
https://geoip.nekudo.com/api/?lang=en&type=full
With the current approach (using URL segments), it seems that users are required to specify the IP if they also want to specify the language or type.
https://geoip.nekudo.com/api/{How_to_not_specify_IP_here}/en/full
(Or maybe somehow values that don't look like an IP in that segment are ignored?)
Thanks so much for your amazing service! I'm very impressed and really appreciate it.
Trying to use:
public function getStateName(City $record, $language) { if (empty($record->subdivisions->names)) { return false; } $stateData = [ 'name' => $this->getLangValue($record->subdivisions->names, $language), 'code' => $record->subdivisions->isoCode, ]; return $stateData; }
to get subdivision data. but it fails, and returns false
always.
Also, if you browse in full mode you'll see subdivision as: "subdivisions":[{"geoname_id":2861876,"iso_code":"NW","names":{"de":"Nordrhein-Westfalen","en":"North Rhine-Westphalia","es":"Renania del Norte-Westfalia","fr":"Rh\u00e9nanie du Nord-Westphalie","ru":"\u0421\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0420\u0435\u0439\u043d-\u0412\u0435\u0441\u0442\u0444\u0430\u043b\u0438\u044f"}}]
There seems to be an array within an array that is causing subdivision to surround with []
how to set json "time_zone":"America/Los_Angeles" -> "time_zone":"America/Los_Angeles". no have "". Sorry im newbie
This is a tremendous GEO lookup. Thank you. Wondering if it is easy to add a property to the location object that represents the timezone as hour offset from GMT/UTC (+/-). Doesn't have to identify daylight savings changes. The timezone string is helpful but requires significant parsing/mapping depending on the underlying system being used to determine the timezone hour offset. Note that this application is for a server-side request where the timezone offset in Date objects represents the "server's" location so we need to use the timezone from the lookup results to get an accurate idea of what timezone the user is in. Thank you so much.
I am using this api from server.
I have tried with one of my mobile's IP (125.18.77.25).
I am located in Mumbai, however the API returns city as New Delhi.
Can you suggest if I am doing something wrong or if the API is buggy?
Here is the full url that I am consuming: http://geoip.nekudo.com/api/125.18.77.25/en/full
Please return both ipv4 and ipv6 if available.
The country attribute is always expected to be an object. But for ip address with empty / no country details it's returning empty list causing parsing exception to us.
Eg, http://geoip.nekudo.com/api/107.167.97.196
Output : {"city":false,"country":[],"location":{"accuracy_radius":1000,"latitude":35,"longitude":105,"time_zone":"Australia/Perth"},"ip":"107.167.97.196"}
Why don't you directly send empty object rather than empty list.
What is considered an abuse of this api? I'm aware that there is no limits by default, but what type of abuse would get my ip blocked?
http://geoip.nekudo.com/api/ returns undefined for IPv6, though works smootly for IPv4.
I work as a network administrator for a small provider in a little town in eastern Ukraine. This service is used by many social networks and erroneous data cause problems for our clients. tell me where to make a request for a change in location for specific ranges of IP, since your service instead of the country Ukraine gives out Estonia.
You have been doing a great job with this api.
But this could be a great improvement.
For e.g. if i call the endpoint 'http://geoip.nekudo.com/api/en/full' it doesn't return the ip address and doesn't format data very well. State is inside subdivisions and doesn't respect the language constraint for en.
It could be a a great improvement and will increase the crowd using this endpioint
I've had plenty of fun using your GeoIp API server.
Now I'm trying to setup the ShinyGeoip API on my own server.
I've pointed the Document Root Folder to www successfully. But how can I use htaccess to redirect requests to the index.php file..?
Concerning;
Point your webserver to the www folder.
Rewrite all requests to the index.php file (Using htaccess, nginx configuration, e.g.).
Regards, and a huge thanks for the amazing geolocation API!
Chiappa
Hello. i recently tried to set up my own instance of this api on my own server running Ubuntu 14.04. On the server, the api was installed successfully and the requests were modified to be sent to example.com/www which is where the index.php file is in the code. The database was also downloaded via the sh file in cli. The api returned dispatch(); upon calling the index.php file, however, and it may be due to a code error. Please fix this issue.
I would like to ask if the latitude and longitude through ip query is not the same as the WGS84 coordinate system, which is the same as that used by Google Maps.
is there a way to pull State from IP?
Just want to make sure, do you guys keep the server? 24*7 and the service running? Am gonna use this in one of my production site. So dont want to see the API going down randomly.
Let me know if you guys offer any paid service too. ( A small amount )
Dear Simon,
I discovered your GeoIP REST API https://geoip.nekudo.com/ tonight and started using it in my project. Thank you very much for providing it for free as well for HTTPS !
Would it be possible to get also zipcodes from JSONP responses ?
Thanks in advance.
All the best
Hi,
I tried to use simple "get" method in JS, however it returns that error: Origin http://screets.com is not allowed by Access-Control-Allow-Origin.
Here is the code:
var fn_get = function( url, callback ) {
var self = this,
xhr = new XMLHttpRequest();
xhr.open( "GET", url, false );
// Handle response
xhr.onreadystatechange = function() {
if ( xhr.readyState == 4 ) {
// Perfect!
if( xhr.status == 200 ) {
if( callback ) { callback( JSON.parse( xhr.responseText ) ); }
// Something wrong!
} else {
if( callback ) { callback( null ); }
}
}
};
// Initiate request
xhr.send( null );
};
fn_get( 'http://geoip.nekudo.com/api/', function(geo) {
console.log(geo);
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.