search
Homephp教程php手册IP反查域名PHP源码
IP反查域名PHP源码Jun 13, 2016 am 10:46 AM
bingphpgenerallydomain nameyesQuery functionSource codeNowuseof

IP反查域名,现在用的一般是bing的一个IP查询功能,即IP:222.222.222.222
 
写成php代码就变成了
 
 
// 调用方法  
$result=getResult("124.205.228.114");  
print_r($result);  
 
function getContent($url){  
    $content=file_get_contents($url);  
    return $content;  
}  
 
function getResult($ip){  
    $pagesize=10;  
    $page=1;  
    $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";  
    $result=array();  
    do 
    {  
        $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";  
        $content=getContent($url);  
        $pattern="/([a-zA-Z0-9\.]*)(?:\/.*)?/isU";  
        preg_match_all($pattern, $content, $matches);  
        $result=array_merge($result,$matches[1]);  
        $nextpage=strpos($content, "下一页");  
        $page=$page+$pagesize;  
    }while($nextpage);  
      
    $result=array_values(array_unique($result));  
      
    return $result;  
}  
 
?> 
 
// 调用方法
$result=getResult("124.205.228.114");
print_r($result);
 
function getContent($url){
       $content=file_get_contents($url);
       return $content;
}
 
function getResult($ip){
       $pagesize=10;
       $page=1;
       $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";
       $result=array();
       do
       {
              $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page";
              $content=getContent($url);
              $pattern="/([a-zA-Z0-9\.]*)(?:\/.*)?/isU";
              preg_match_all($pattern, $content, $matches);
              $result=array_merge($result,$matches[1]);
              $nextpage=strpos($content, "下一页");
              $page=$page+$pagesize;
       }while($nextpage);
      
       $result=array_values(array_unique($result));
      
       return $result;
}
 
?>
 
 
摘自 gaohui blog

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
php怎么把负数转为正整数php怎么把负数转为正整数Apr 19, 2022 pm 08:59 PM

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

主机的域名和主机的ip地址两者之间的关系是什么主机的域名和主机的ip地址两者之间的关系是什么Jan 14, 2021 pm 06:02 PM

主机的域名和主机的ip地址两者之间的关系是:一个IP地址对应多个域名。IP地址用数字化形式来对计算机网络中的主机进行网络标识,域名用字符化形式来对计算机网络中的主机进行网络标识。在Internet中,一个域名之内能够对应一个IP地址,但是一个IP地址可以被多个域名所对应。

请求的控件无效 NET HELPMSG 2191:2 个简单修复请求的控件无效 NET HELPMSG 2191:2 个简单修复Apr 15, 2023 am 09:13 AM

在TCP/IP协议套件中,域名系统是提供计算机名称到IP地址映射名称解析服务的协议之一。但是,有时它会出现故障,从而导致错误,例如请求的控制对此服务NETHELPMSG2191无效。DNS客户端和服务器协同工作,为计算机和用户提供计算机名称到IP地址映射名称解析服务。安装Windows后,客户端和服务器版本的操作系统默认启用客户端服务。一旦您在TCP/IP网络配置中指定了服务器的IP地址,DNS客户端就会查询服务器以发现域控制器并将计算机名称解析为IP地址。只有在服务

php怎么除以100保留两位小数php怎么除以100保留两位小数Apr 22, 2022 pm 06:23 PM

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

php怎么根据年月日判断是一年的第几天php怎么根据年月日判断是一年的第几天Apr 22, 2022 pm 05:02 PM

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

php怎么判断有没有小数点php怎么判断有没有小数点Apr 20, 2022 pm 08:12 PM

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

php怎么设置implode没有分隔符php怎么设置implode没有分隔符Apr 18, 2022 pm 05:39 PM

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。

国内永久免费域名申请方法是什么国内永久免费域名申请方法是什么Jan 19, 2024 pm 04:01 PM

申请方法:1、通过工信部网站申请免费域名,等待审核通过后即可获得免费域名;2、通过DNSPod免费申请域名,用户可以在DNSPod上注册账号并申请免费的二级域名;3、选择一个可靠的免费域名服务提供商,通过对比和了解,选择一个可靠的提供商;4、注册账号,点击注册按钮,按照要求填写相关个人信息并创建账号;5、搜索并选择域名即可。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software