geoip

GeoIp redirect specific country Traffic to country domain?

拈花ヽ惹草 提交于 2019-12-18 07:22:49
问题 I want to redirect US country traffic to my country domain from mydomain.com . My website is in Wordpress and i would prefer .htaccess. i have applied the below code but it redirecting all IP addresses to mydomain.us . Will any body help? GeoIPEnable On RewriteEngine on RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(US)$ RewriteRule ^(.*)$ http://mydomain.us [R,L] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME}

Cache JSON response

馋奶兔 提交于 2019-12-18 03:45:31
问题 I using some GeoIP service to place country flag on pages depends on country IP. And I need to cache JSON response for all pages on my site. This code placed into header.php : $.getJSON('http://smart-ip.net/geoip-json?callback=?', function(data) { $('#flag').html("<a class='fancybox-inline int' href='#international'><img src='/images/flags/"+data.countryCode+".png'></a>"); } Is it possible to cache it with $.ajaxSetup({ cache: true }) ? - seems to not work. Or probably better to use HTML5

PHP5.5安装GeoIP扩展

二次信任 提交于 2019-12-17 19:19:34
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 安装 GEOIP [ root @i - it ~]# yum install GeoIP GeoIP - deve ##下载GeoIP的数据库,有精确到国家和地区包括IPv6 自行选择...### [ root @i - it ~]# wget http : //geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz [ root @i - it ~]# tar zxf GeoLiteCity . dat . gz [ root @i - it ~]# mv GeoIPCity . dat / data / seo / misc / GeoIPCity . dat ##下载GeoIP PECL扩展## [ root @i - it ~]# wget http : //pecl.php.net/get/geoip-1.0.8.tg ##安装## [ root@i - it ~]# tar zxf geoip - 1.0 . 8.tgz [ root@i - it ~]# cd geoip - 1.0 . 8 [ root@i - it geoip - 1.0 . 8 ]# / software / php / bin / phpize [

基于GIScript和GeoIP进行访问网址的地理定位分析

眉间皱痕 提交于 2019-12-17 18:55:12
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 通过网页访问日志分析使用者的地址,然后将其放到地图上,分析访问来源的热区从而得到用户的地图分布,是不是很有用、也很酷?这里介绍个使用GIScript和GeoIP来进行访问网址的地理定位的例子。 这个功能虽然看起来简单,但其实要分为很多个环节的。下面详述: 1、首先是获取IP地址,这个不多说了。在Web服务器的RequestHeaders中都有,也可以通过日志进行提取。从文件中提取可以批量处理,而从访问信息中提取然后直接发送到消息总线或NoSQL之类的高效率存储系统可以实现实时的处理。 2、使用GeoIP讲域名或IP地址解析为地名。GeoIP是MaxMind开发的用于IP到地址的解析工具,包括软件和IP数据库。免费版的定位较粗,而付费版的可以实现较高精度的定位。 3、将地名通过地理编码(Geocoding)功能转换为空间坐标或空间几何对象,需要软件和地图数据的共同支持。这个以前是专业GIS才有的功能,现在google/百度都提供在线服务接口。但是因为在线的有很多限制(网络带宽、并发控制、账号等等),这里使用GIScript这个工具来做。因为与GeoIP都有Python库,很容易集成到一起。如果需要大批量的处理,再假设一个Celery进行并行处理就OK了。 4、统计空间数据库中的数据样本的频度和其它属性

GeoIP的使用

旧巷老猫 提交于 2019-12-17 18:36:11
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> GeoIP介绍: 什么是GepIP ? 所谓GeoIP,就是通过来访者的IP, 定位他的经纬度,国家/地区,省市,甚至街道等位置信息。这里面的技术不算难题,关键在于有个精准 的数据库。有了准确的数据源就奇货可居赚点小钱,可是发扬合作精神,集体贡献众人享用是我们追求的。 GeoIP如 何使用? 首先我们需要数据信息,所以先获取一个免费的数据库: //sjolzy.cn/php/GeoIP/bak/GeoIP.dat.gz ,接着解压得到:GeoIP.dat, 然后就是对数据文件的按需操作,这边范例使用的是PHP。 GeoIP + PHP的使用 方法一: 下载 GeoIP 的 PHP 文件geoip.inc,保存为 geoip.inc.php //sjolzy.cn/php/GeoIP/bak/geoip.inc php使用代码 include("geoip.inc.php"); // 打开数据文件 $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD); // 获取国家代码 $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); echo "Your country code is:

PHP轻松实现"附近的人"功能,根据IP确定经纬度,根据经纬度计算距离

五迷三道 提交于 2019-12-17 17:58:52
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> PHP安装GeoIP扩展和数据库根据IP获取访客所在国家/城市/经纬度等信息 然后就可以用geoip_record_by_name($_SERVER['REMOTE_ADDR'])根据用户IP确定经纬度了. 注意:geoip_record_by_name()返回的西经和南纬是负数. 5000米转成经纬度: 纬度 Latitude: 1 deg = 110852 m 经度 Longitude: 1 deg = 111320*cos(lat) m 同一经线上,相差一纬度约为 110852 米 同一纬线上,相差一经度约为 111320*cos(lat) 米 (lat为该纬线的纬度) <?php //以当前用户经纬度为中心,查询5000米内的其他用户 $y = 5000 / 110852; //纬度的范围 $x = 5000 / (111320*cos($lat)); //经度的范围 $sql = ' select * from user where lat >= ($lat-$y) and lat <= ($lat+$y) and lon >= ($lon-$x) and lon <= ($lon+$x); '; 数据库用户表中设两个字段,分别存储用户的经度lat和纬度lon. ($lat-$y) <= lat <=

How to improve performance of GeoIP query in BigQuery?

不羁的心 提交于 2019-12-17 10:44:08
问题 I have loaded my application logs in BigQuery and I need to calculate country based on IP address from those logs. I have written a join query between my table and a GeoIP mapping table that I downloaded from MaxMind. An ideal query would be OUTER JOIN with range filter, however BQ supports only = in join conditions. So the query does an INNER JOIN and handles missing values in each side of the JOIN . I have amended my original query so it could run on the Wikipedia public data set. Can

Identifying country by IP address

时光怂恿深爱的人放手 提交于 2019-12-17 09:18:29
问题 Is there a way to figure out the country name just by looking at an IP address? I mean, do countries have specific ranges of IP addresses? For example, Australia can have IP addresses only in the range of 123.45.56.89 - 231.54.65.98 (just an example) 回答1: I think what you're looking for is an IP Geolocation database or service provider. There are many out there and some are free (get what you pay for). Although I haven't used this service before, it claims to be in real-time. https://kickfire

Contradiction between GeoLite2 database and GeoIP2 precision web service

江枫思渺然 提交于 2019-12-13 19:13:46
问题 I am using the GeoLite2 city-blocks and city-location free databases and found the following ip_addresses have same locid number of 223, however if I type these addresses to GeoIP2 precision web service it gives me 4 different location information. Should one locid number correspond to only one location? I am really confused? 12.234.227.170 (WI, US by GeoIP2) 69.174.58.60 (IL, US by GeoIP2) 71.216.182.245 (Bremerton, Washington by GeoIP2) 74.44.255.2 (Lakeville MN by GeoIP2) 回答1: GeoLite2 and

Compile Maxmind C library with visual studio 2010

陌路散爱 提交于 2019-12-13 04:53:43
问题 does anybony compiled successfully the Maxmind C library on Visual Studio 2010? I'm not able to compile it on Windows because I get a lot of errors regarding files not found like unistd.h 回答1: The error that you are seeing is probably because you are including GeoIPUpdate which isn't really necessary. GeoIPUpdate is a standalone script for updating the databases, and isn't necessary to use the APIs themselves. Try removing that to see if that resolves your issues. Additionally, to get version