第一步:在根目录添加新项(类),新建一个类文件,把以下文件粘贴到该类文件下:   using System; using System.Collections.Generic; using System.Text; using System.Net; using System.IO; using System.Diagnostics;         public class RedirectMode     {         public static readonly int Mode_1…
百度天气 接口地址:http://api.map.baidu.com/telematics/v3/weather?location=上海&output=json&ak=hXWAgbsCC9UTkBO5V5Qg1WZ9,其中ak是密钥,自行去申请即可,便于大家测试,楼主就公布并了自己的Key,这样可以直接获取到数据. 获取到的数据是这样的: {"error":0,"status":"success","date"…
根据IP获取所在的国家城市 新浪的IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js 新浪多地域测试方法:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=119.139.196.127 搜狐IP地址查询接口(默认GBK):http://pv.sohu.com/cityjson 搜狐IP地址查询接口(可设置编码):http://pv…
函数: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 function https_request($url,$data = null){     $curl = curl_init();           curl_setopt($cu…
原本使用新浪Api,然后发现不行了,以下小编重新查找了几个,个人推荐太平洋的接口 1.首先获取真实ip $ip = $_SERVER['REMOTE_ADDR']; 2.要知道的Api接口 几个接口$ip 为上边声明变量 淘宝 : http://ip.taobao.com/service/getIpInfo.php?ip=$ip; 搜狐  :   http://pv.sohu.com/cityjson?ie=utf-8; 太平洋 :   http://whois.pconline.com.cn/…
原文链接:http://blog.csdn.net/johnnycode/article/details/42028841 MaxMind GeoIP2 服务能识别互联网用户的地点位置与其他特征,应用广泛,包括个性化定制内容.诈欺检测.广告定向.网站流量分析.执行规定.地理目标定位.地理围栏定位 (geo-fencing)以及数字版权管理.目前使用 GeoIP 更多是配合Nginx或Apache服务器进行日志分析获取网站访问量地域分布状况. GeoIP 分为商业版和免费版,免费版比商业版精度差了…
<script type="text/javascript"> var map = new BMap.Map("allmap"); var point = new BMap.Point(116.331398,39.897445); map.centerAndZoom(point,12); function myFun(result){ var cityName = result.name; map.setCenter(cityName); console…
这里用的file_put_contents,你也可以用别的,直接怼代码: //拼接传递的参数$ip = '175.12.53.12' $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Content-type:application/x-www-form-urlencoded\r\n", ));//获取Ip所属位置$context = stream_context_create($o…
这里用的file_put_contents,你也可以用别的,直接怼代码: //拼接传递的参数 $getData = array( 'query' => '127.0.0.1', 'resource_id' => '6006', 'oe' => 'UTF-8', 'format' => 'json' ); $getData = http_build_query($getData); $opts = array( 'http'=>array( 'method'=>"…
这个 首先说明下.ip库是qq纯真ip库 dat文件类型 public static string QQipPath = AppDomain.CurrentDomain.BaseDirectory + "\\ipdata\\qqwry.dat";///QQ纯真ip库地址 public static string GetCity(string IP) { string ipfilePath = QQipPath; IPSearch ipSearch = new IPSearch(ipfi…