Home  >  Article  >  Backend Development  >  IP138 IP地址查询 php实例

IP138 IP地址查询 php实例

WBOY
WBOYOriginal
2016-06-23 13:50:431736browse


复制代码代码如下:


$ip="www.jb51.net"; //$ip可以任意改成其他域名或者是ip地址 
$source=file_get_contents('http://www.ip138.com/ips.asp?ip='.$ip.'&action=2'); 
//正则匹配 
preg_match_all("/

  • (.*)/isU",$source,$result); 
    print_r($result[1]); 
    ?> 

    输出结果: 
    XML/HTML代码 

    复制代码代码如下:


    Array 

    [0] => 本站主数据:美国 
    [1] => 参考数据一:美国 
    [2] => 参考数据二:美国 加利福尼亚州山景市谷歌公司 

  • Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn