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的更多相关文章

  1. PHP通过IP 获取 地理位置(实例)

    发布:JB02   来源:脚本学堂  分享一例php代码,实现通过IP地址获取访问者的地理位置,在php编程中经常用到,有需要的朋友参考下吧.本节内容:PHP通过IP获取地理位置 例子: 复制代码代码 ...

  2. PHP获取用户真实 IP , 淘宝IP接口获得ip地理位置(转)

    <?php /** * 获取用户真实 IP */ function getIP() { static $realip; if (isset($_SERVER)){ if (isset($_SER ...

  3. PHP通过IP 获取 地理位置(实例代码)

    发布:JB02   来源:脚本学堂 分享一例php代码,实现通过IP地址获取访问者的地理位置,在php编程中经常用到,有需要的朋友参考下吧.本节内容:PHP通过IP获取地理位置 例子: 复制代码代码示 ...

  4. PHP获取操作系统、IP、地理位置、浏览器、ISP等信息_PHP类代码

    PHP语言.浏览器.操作系统.IP.地理位置.ISP,本PHP类里面有以下几种方法,同时也是用法说明: <?php class class_guest_info{ function GetLan ...

  5. 分享几个IP获取地理位置的API接口(最全面的了)

    转载;https://cloud.tencent.com/developer/article/1152362 全网首发,最全的IP接口,不服来辩!博主找了几个小时的资料,又手动抓取到了几个接口补充进来 ...

  6. PHP根据ip获取地理位置(通过高德地图接口)

    PHP根据ip获取地理位置(通过高德地图接口)<pre>//restapi.amap.com/v3/ip?key=2004f145cf3a39a72e9ca70ca4b2a1dc& ...

  7. 根据本地ip获取地理位置,再根据地理位置,获取天气

    import json,requestsfrom urllib.request import urlopenfrom pyquery import PyQuery as pqfrom lxml imp ...

  8. HTML5获取地理位置

    包含了以下功能:(1)通过IP地址获取城市地址(并不完全准确,存在代理IP或IP中转时定位与实际位置不一致的情况)(2)通过移动端浏览器及GPS定位位置坐标(3)根据位置坐标转换百度地图坐标(4)根据 ...

  9. 如何获取外网Ip呢, 终于找到方法了

    临时更换网址:http://20140507.ip138.com/ic.asp 这个网址能同时获取ip和城市名字 上面的网址如何来的呢,其实很简单,随便打开一个获取Ip的网站,比如http://www ...

随机推荐

  1. Spring MVC常见的三种URL请求参数的处理

    //方法1:@RequestParam //url:/test1?id=123 @RequestMapping(value = "/test1",method = RequestM ...

  2. Linux档案与目彔的基本操作(查看与权限)

    此文包含的命令: cd.pwd.mkdir.rmdir.rm.ls.cp.mv.cat.tac.more.less.head.tail.od.touch.umask.chattr.lsattr.fil ...

  3. [html]选项卡效果

    晨间新闻 午间新闻 晚间新闻 视频新闻 <!doctype html> <html> <head> <meta charset="UTF-8&quo ...

  4. How to Use JUnit With JMeter

    Do you need to use JUnit in your testing processes? To answer this question, let's take a look first ...

  5. gvim 配置Pydiction

    配置windows下gvim 的python关键字补全插件Pydiction 1.下载Pydiction 2.解压缩包,里面有after文件夹.complete-dict.pydiction.py 3 ...

  6. Azure china服务状态报告查看网址

    https://www.azure.cn/support/service-dashboard/

  7. UIColor 分类 16进制转 RGB

    .h #import <UIKit/UIKit.h> @interface UIColor (WJ) + (UIColor *)colorWithWJString:(NSString *) ...

  8. 在CentOS安装cobbler自动化部署软件

    #!/bin/bash##cobbler server addressip=192.168.119.133#DHCP server net and address fanweinet=192.168. ...

  9. Linux中exec命令相关

    Linux中exec命令相关 exec和source都属于bash内部命令(builtins commands),在bash下输入man exec或man source可以查看所有的内部命令信息. b ...

  10. cocos2dx release note

    [传送门] 发布说明: https://github.com/fusijie/Cocos2dx-ReleaseNote-zh/blob/master/SUMMARY.md 更新记录: https:// ...