网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站设计 > PHP
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   IP: 112.87.30.158
Old 2015-04-18, 06:36 PM
Mackinaw Mackinaw is offline
初级会员
 
Join Date: 2011-04-17
Posts: 4
Mackinaw 现在声名狼藉
Default 精准淘宝ip城市定位

目前提供的服务包括:
1.根据用户提供的IP地址,快速查询出该IP地址所在的地理信息和地理相关的信息,包括国家、省、市和运营商。
2.用户可以根据自己所在的位置和使用的IP地址更新我们的服务内容。

我们的优势:
1.提供国家、省、市、县、运营商全方位信息,信息维度广,格式规范。
2.提供完善的统计分析报表,省准确度超过99.8%,市准确度超过96.8%,数据质量有保障。

Code:
01.<?php
02.
03.functiongetIP(){
04.if(@$_SERVER["HTTP_X_FORWARDED_FOR"])
05.$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];
06.elseif(@$_SERVER["HTTP_CLIENT_IP"])
07.$ip=$_SERVER["HTTP_CLIENT_IP"];
08.elseif(@$_SERVER["REMOTE_ADDR"])
09.$ip=$_SERVER["REMOTE_ADDR"];
10.elseif(@getenv("HTTP_X_FORWARDED_FOR"))
11.$ip=getenv("HTTP_X_FORWARDED_FOR");
12.elseif(@getenv("HTTP_CLIENT_IP"))
13.$ip=getenv("HTTP_CLIENT_IP");
14.elseif(@getenv("REMOTE_ADDR"))
15.$ip=getenv("REMOTE_ADDR");
16.else
17.$ip="Unknown";
18.return$ip;
19.}
20.
21.$ip=getIP();//获取当前用户的ip
22.$url="http://ip.taobao.com/service/getIpInfo.php?ip=".$ip;
23.$ipinfo=json_decode(file_get_contents($url));
24.if($ipinfo->code=='1'){
25.returnfalse;
26.}
27.
28.$country=$ipinfo->data->country;
29.$prnce=$ipinfo->data->region;
30.$city=$ipinfo->data->city;
31.$isp=$ipinfo->data->isp;
32.
33.if(strstr($country,"中国")){
34.header("location:http://www.oddpi.com");
35.}
36.
37.?>
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:08 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.