geoip

How create GeoIP functionality in PHP project?

て烟熏妆下的殇ゞ 提交于 2019-12-03 20:14:43
I have some IP adress ( $_SERVER['REMOTE_ADDR'] ) and I must receive (learn) name of country and it would be nice if I can receive (learn) name of city too. And don't forget It's php-project, useful API - very good. P.S. It's some open-source project and we must use only free and open-source tools. None (only the 'GeoIP.dat' file is needed). To download a free GeoIP Standard Country database, go to http://maxmind.com/download/geoip/database/ Install Just place the 'geoip.inc' file somewhere according to the 'include_path' directive of your 'php.ini' file, or just place it in the same directory

How does the binary DAT from Maxmind work?

主宰稳场 提交于 2019-12-03 16:24:02
Maxmind offers a binary DAT file format for downloading their GeoIP database. http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz Does anyone know how this has been packaged? Also, is there any kind of copy protection on the data? I'd like to offer up a set of data in a similar way. Anyone with any knowledge of this will receive my undying gratitude :-) It's just a proprietary binary format, heavily optimized for IP address querying. It doesn't have any copy protection. If you really want to reverse-engineer the format, take a look at the C# or Java API. I don't know if this

Best way to get user nearest city? Python/Django

非 Y 不嫁゛ 提交于 2019-12-03 11:14:57
问题 I have a website with a limited number of cities in the database, and need to show the user the nearest city to his current location. I can get the location by MaxMind API, but I want to get the nearest city in my database to user city. For example, if I have these cities in the database: Los Angeles , San Francisco and New York City , and I'm accessing from other city like Miami , I should see NYC selected because it's the nearest geographically. What's the best way to do this quick and

Getting location details from IP in PHP

☆樱花仙子☆ 提交于 2019-12-03 07:50:57
问题 Is it possible to get the location details from the users IP Address in PHP. Any suggestions ?? Thanks 回答1: $ip = '98.229.152.237'; $xml = simplexml_load_file("http://ipinfodb.com/ip_query.php?ip=$ip"); print_r($xml); Output: SimpleXMLElement Object ( [Ip] => 98.229.152.237 [Status] => OK [CountryCode] => US [CountryName] => United States [RegionCode] => 33 [RegionName] => New Hampshire [City] => Manchester [ZipPostalCode] => 03103 [Latitude] => 42.9403 [Longitude] => -71.4435 [Timezone] =>

How to enable dynamic module with an existing NGINX installation

痴心易碎 提交于 2019-12-03 04:40:56
问题 Introduction From NGINX version 1.9.11 and upwarts, a new feature is introduced: dynamic modules. With dynamic modules, you can optionally load separate shared object files at runtime as modules – both third-party modules and some native NGINX modules. (source) My setup and the problem I have NGINX installed from the mainline (currently 1.9.14) so it is capable to use dynamic modules. It has also the module I want dynamicly enabled: nginx -V nginx version: nginx/1.9.14 built by gcc 4.8.4

(python) [Errno 11001] getaddrinfo failed

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can someone help me on how I can catch this error? import pygeoip gi = pygeoip.GeoIP('GeoIP.dat') print gi.country_code_by_name('specificdownload.com') Traceback (most recent call last): File "<module1>", line 14, in <module> File "build\bdist.win-amd64\egg\pygeoip\__init__.py", line 447, in country_code_by_name addr = self._gethostbyname(hostname) File "build\bdist.win-amd64\egg\pygeoip\__init__.py", line 392, in _gethostbyname return socket.gethostbyname(hostname) gaierror: [Errno 11001] getaddrinfo failed 回答1: Well, let’s ask Python what

Tile Map geo.location field not present under GeoHash aggregation in Kibana 4.0.1

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to get a tile map visualization working in Kibana 4.0.1. I can see the geoip.location data in the Discover section but when I go to Visualize it as a Tile Map, I select Geo Coordinates bucket type, then aggregation type GeoHash , then when I go to Field it's blank. Kibana 4.0.1 Logstash 1.4.2-1-2c0f5a1 Elasticsearch 1.4.4 Running on Debian 7 64bit Here's my logstash config: input { udp { port => 5514 type => cisco } } filter { grok { match => { "message" => "\%{NUMBER:seq}: \*%{SYSLOGTIMESTAMP:date}: \%SEC-6-IPACCESSLOGP: list

NGINX &#039;Access-Control-Allow-Origin&#039; header contains multiple values

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an NGINX server with PHP (let's assume a hostname of http://myserver.com ). I have a PHP script that I'm accessing via XHR from a web page on my localhost. I'm using it as a GeoIP server similar to freegeoip.net. I'm trying to lock down XHR to specific domains. Here's my config setup: location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_param GEOIP_COUNTRY_CODE $geoip2_data_country_code; fastcgi

Best way to get user nearest city? Python/Django

試著忘記壹切 提交于 2019-12-03 00:45:29
I have a website with a limited number of cities in the database, and need to show the user the nearest city to his current location. I can get the location by MaxMind API, but I want to get the nearest city in my database to user city. For example, if I have these cities in the database: Los Angeles , San Francisco and New York City , and I'm accessing from other city like Miami , I should see NYC selected because it's the nearest geographically. What's the best way to do this quick and performance aware? You should store the approximate latitude and longitude for each city, calculate the

nginx 之高级模块

匿名 (未验证) 提交于 2019-12-02 22:10:10
secure_link_module 模块 作用: 制定并允许检查请求的链接的真实性以及保护资源免遭未经授权的访问 限制链接生效周期 配置语法 Context:http、server、location secure_link模块实现请求资源验证 server { listen 80; server_name www.zhangbiao.com; root /opt/app/code; location / { secure_link $arg_md5,$arg_expires; secure_link_md5 "$secure_link_expires$uri imooc"; if ($secure_link = "") { return 403; } if ($secure_link = "0") { return 410; } } } }    在/opt/app/code/download下准备一个文件用于下载 找一个md5加密的文件放在/opt/work下,这里如果没有的openssl命令话需要用yum安装 #!/bin/sh # #Auth:www.zhangbiao.com servername="www.zhangbiao.com" download_file="/download/test.img" time_num=$(date -d "2019-7-18 00