1 <?php 2 3 function getIp($url) { 4 $data = file_get_contents("http://www.ip138.com/ips138.asp?ip={$url}&action=2"); 5 preg_match("/(d+.d+.d+.d+)</font>/", $data, $arr); 6 if(!empty($arr[1])) { 7 return $arr[1]; 8 } 9 return $url; 10 } 11 12 function getBing($ip) { 13 $ctx = stream_context_create(array( 14 'http' => array( 15 'timeout' => 30, 16 //'proxy' => 'tcp://113.47.46.152:1080', 17 'request_fulluri' => True, 18 'header'=> "User-Agent: BaiduSpider Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3", 19 ) 20 ) 21 ); 22 $first = 1; 23 $res = array(); 24 while(true) { 25 $url = "http://www.bing.com/search?q=ip%3A{$ip}&go=%E6%8F%90%E4%BA%A4&qs=n&first={$first}&form=QBRE&pq=ip%3A{$ip}&sc=0-0&sp=-1&sk=&cvid=5ee24683a0bdf047de60abfc"; 26 $first = $first + 10; 27 $result = file_get_contents($url, False, $ctx); 28 preg_match_all('/<h2><a href="https://www.cnblogs.com/k1two2/p/((http|https)://([w|.]+)/)([w|/|&|=|.|?]+)?" h="ID=w+,w+.w+">/',$result,$arr); 29 if(!empty($arr[1])) { 30 foreach($arr[1] as $v) { 31 array_push($res, $v); 32 } 33 } 34 if(!preg_match('/<div class="sw_next">/', $result)) { 35 break; 36 } 37 38 } 39 return array_unique($res); 40 } 41 42 //getBing("58.96.186.133"); 43 44 function main() { 45 if(isset($_POST["action"])) { 46 $action = trim($_POST["action"]); 47 if($action == "getip") { 48 $domain = trim($_POST["domain"]); 49 $ip = getIp($domain); 50 echo $ip; 51 } 52 if($action == "query") { 53 $ip = trim($_POST["ip"]); 54 $res = getBing($ip); 55 echo json_encode($res); 56 } 57 } 58 } 59 60 main(); 61 if(empty($_POST['action'])) { 62 ?> 63 <!DOCTYPE html> 64 <html> 65 <head> 66 <title>必应接口C段查询|c段查询|旁站查询</title> 67 <meta charset="utf-8"> 68 <meta > 69 <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css"> 70 <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> 71 <script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script> 72 <script src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 73 <style type="text/css" media="screen"> 74 .main{ 75 width:90%; 76 //border:1px solid red; 77 margin-top:20px; 78 } 79 .ip{ 80 margin-top:10px; 81 } 82 dd{ 83 text-indent:10px; 84 } 85 </style> 86 </head> 87 <body> 88 <div class="container"> 89 <div class="main"> 90 <h1>必应接口C段查询 </h1> 91 <form class="form-inline"> 92 <div class="form-group" style=""> 93 <input type="text" id="domain" class="form-control" placeholder="输入你要查询的ip或域名"> 94 </div> 95 <button type="submit" class="btn btn-success" id="getip">获取ip</button> 96 <button type="submit" class="btn btn-info" id="query">查询</button> 97 </form> 98 <div class="alert alert-info ip" role="alert" style="display:none">IP:<span id="ip"></span><span id="se"></span></div> 99 <div class="progress" id="jd" style="display:none"> 100 <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="40" id="b" aria-valuemin="0" aria-valuemax="100" style="width: 0%"> 101 <span class="sr-only">40% Complete (success)</span> 102 </div> 103 </div> 104 <dl id="result"> 105 106 </dl> 107 </div> 108 </div> 109 </body> 110 <script type="text/javascript"> 111 var ipi = 1; 112 $(function() { 113 $("#getip").click(function() { 114 var domain = $("#domain").val(); 115 if(domain == "") { 116 alert("请输入ip或者域名"); 117 return false; 118 } 119 $.post("","action=getip&domain="+domain,function(res) { 120 var ip = res; 121 $("#ip").html(ip); 122 $(".ip").show(); 123 arr = ip.split("."); 124 start = arr[0] + "." + arr[1] + "." + arr[2] + "." + 1; 125 end = arr[0] + "." + arr[1] + "." + arr[2] + "." + 255; 126 $("#se").html(" 查询ip段:" + start + "-" + end) 127 }) 128 }); 129 130 $("#query").click(function() { 131 ipi=1; 132 $("#b").css("width","0%"); 133 $("#result").html(""); 134 $("#jd").show(); 135 query(); 136 137 }); 138 }) 139 140 function query() { 141 $("#query").click(function() { 142 return; 143 }); 144 var html = ""; 145 var b = (ipi/255) * 100; 146 var ip = $("#ip").html(); 147 if(ip == "") { 148 alert("骚年请先获取Ip哦"); 149 return; 150 } 151 var arr = ip.split("."); 152 var ips = arr[0] + "." + arr[1] + "." + arr[2] + "." + ipi; 153 154 $.post("","action=query&ip="+ips,function(res) { 155 $("#b").css("width",b+"%"); 156 html += "<dt>"+ ips +"</dt>"; 157 for(var i in res) { 158 html += "<dd><a href="https://www.cnblogs.com/k1two2/p/" + res[i] + "" target="_blank">" + res[i]+"</a></dd>"; 159 160 } 161 $("#result").append(html); 162 if(ipi<255) { 163 ipi++; 164 query(); 165 } 166 },"json"); 167 } 168 </script> 169 </html> 170 171 <?php 172 } 173 ?>到此这篇域名ip在线查询(域名ip在线查询)的文章就 介绍到这了,更多相关内容请继续浏览下面的相关 推荐文章,希望大家都能在 编程的领域有一番成就!
版权声明:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权、违法违规、事实不符,请将相关资料发送至xkadmin@xkablog.com进行投诉反馈,一经查实,立即处理!
转载请注明出处,原文链接:https://www.xkablog.com/bcyy/29967.html