paip.获取地理位置根据Ip
paip.获取地理位置根据Ip
html转换txt
正则表达式截取mid
作者Attilax 艾龙, EMAIL:1466519819@qq.com
来源:attilax的专栏
地址:http://blog.csdn.net/attilax
private static String addr(String ip) {
String urlContent = WebpageContent("http://www.123cha.com/ip/?q="+ip,"utf-8");
String txt=html2txt(urlContent);
String left="参考数据一:";
String add=com.attilax.text.strUtil.Mid(txt, left, "参考数据二:");
return add;
}
private static String html2txt(String urlContent) {
org.jsoup.nodes.Document doc = null;
//filex.write(path + ".htm", html);
doc = Jsoup.parse(urlContent);
return doc.text() ;
}
public static String getMidtrings(String s2,String left,String right) {
// String s2=" 周期 Statement?cycle 2013/11/15?-?2013/12/14 ";
// s2=doc.text();
String abcdef="abcdef";
String fd=left+"(.*?)"+right;
String s= strUtilO36.getMidtrings(s2, fd);
return s;
}
/**
*
* @param str
* @param find "qq(.*?)qq"
*/
public static String getMidtrings(String str,String find) {
// String str = "rrwerqq84461376qqasfdasdfrrwerqq84461377qqasfdasdaa654645aafrrwerqq84461378qqasfdaa654646aaasdfrrwerqq84461379qqasfdasdfrrwerqq84461376qqasfdasdf";
//"qq(.*?)qq"
Pattern p = Pattern.compile(find);
Matcher m = p.matcher(str);
ArrayList<String> strs = new ArrayList<String>();
while (m.find()) {
strs.add(m.group(1));
}
// for (String s : strs){
// System.out.println(s);
//// }
if(strs.size()==0)
return "";
return strs.get(0);
}
paip.获取地理位置根据Ip的更多相关文章
- PHP通过IP 获取 地理位置(实例)
发布:JB02 来源:脚本学堂 分享一例php代码,实现通过IP地址获取访问者的地理位置,在php编程中经常用到,有需要的朋友参考下吧.本节内容:PHP通过IP获取地理位置 例子: 复制代码代码 ...
- PHP获取用户真实 IP , 淘宝IP接口获得ip地理位置(转)
<?php /** * 获取用户真实 IP */ function getIP() { static $realip; if (isset($_SERVER)){ if (isset($_SER ...
- PHP通过IP 获取 地理位置(实例代码)
发布:JB02 来源:脚本学堂 分享一例php代码,实现通过IP地址获取访问者的地理位置,在php编程中经常用到,有需要的朋友参考下吧.本节内容:PHP通过IP获取地理位置 例子: 复制代码代码示 ...
- PHP获取操作系统、IP、地理位置、浏览器、ISP等信息_PHP类代码
PHP语言.浏览器.操作系统.IP.地理位置.ISP,本PHP类里面有以下几种方法,同时也是用法说明: <?php class class_guest_info{ function GetLan ...
- 分享几个IP获取地理位置的API接口(最全面的了)
转载;https://cloud.tencent.com/developer/article/1152362 全网首发,最全的IP接口,不服来辩!博主找了几个小时的资料,又手动抓取到了几个接口补充进来 ...
- PHP根据ip获取地理位置(通过高德地图接口)
PHP根据ip获取地理位置(通过高德地图接口)<pre>//restapi.amap.com/v3/ip?key=2004f145cf3a39a72e9ca70ca4b2a1dc& ...
- 根据本地ip获取地理位置,再根据地理位置,获取天气
import json,requestsfrom urllib.request import urlopenfrom pyquery import PyQuery as pqfrom lxml imp ...
- HTML5获取地理位置
包含了以下功能:(1)通过IP地址获取城市地址(并不完全准确,存在代理IP或IP中转时定位与实际位置不一致的情况)(2)通过移动端浏览器及GPS定位位置坐标(3)根据位置坐标转换百度地图坐标(4)根据 ...
- 如何获取外网Ip呢, 终于找到方法了
临时更换网址:http://20140507.ip138.com/ic.asp 这个网址能同时获取ip和城市名字 上面的网址如何来的呢,其实很简单,随便打开一个获取Ip的网站,比如http://www ...
随机推荐
- java自带BASE64工具进行图片和字符串转换
java自带BASE64工具进行图片和字符串转换 import java.io.File; import java.io.FileInputStream; import java.io.FileOut ...
- MATLAB - 练习程序,求灰度图像均值、最大、最小数值
clear all; close all; clc img=imread('lena.bmp'); figure; imshow(uint8(img)); [m n]=size(img); img_m ...
- android中的MVP模式
1.建立bean public class UserBean { private String mFirstName; private String mLastName; public UserBea ...
- tar 压缩去除目录
tar zcvf fd.tar.gz * --exclude=file1 --exclude=dir1 注意: 1.yes: --exclude=file1 no: --exclude file1 ...
- 修改默认MYSQL数据库data存放位置
随着业务量的增长,mysql默认安装所在分区大小出现瓶颈,通常需要将datadir换到较大的分区 示例原目录:/usr/local/mysql/data/示例新目录:/data/mysqldata/ ...
- VS 控件命名规范
基本数据类型 数据类型 数据类型简写 标准命名举例 Array arr arrShoppingList Boolean bln blnIsPostBac ...
- C# async await 学习笔记2
C# async await 学习笔记1(http://www.cnblogs.com/siso/p/3691059.html) 提到了ThreadId是一样的,突然想到在WinForm中,非UI线程 ...
- Programming Assignment 2: Randomized Queues and Deques
实现一个泛型的双端队列和随机化队列,用数组和链表的方式实现基本数据结构,主要介绍了泛型和迭代器. Dequeue. 实现一个双端队列,它是栈和队列的升级版,支持首尾两端的插入和删除.Deque的API ...
- Count Colour_poj2777(线段树+位)
POJ 2777 Count Color (线段树) Count Color Time Limit: 1000MS Memory Limit: 65536K Total Submissions ...
- spring常见异常
1.ClassNotFoundException: org.springframework.dao.support.DaoSupport(解决:导入spring-tx) 2.NoClassDefFou ...