网站链接查询工具
<?php header("Content-Type:text/html;charset=gbk"); include_once 'Textclass.php'; $url = '111cnhttp://www.phprm.com'; if (empty($url) || $url == '') $url = $_GET['message']; if (preg_match("/(.*?)\/$/i", $url)) { $url = preg_replace("/\/$/", "", $url); } $message = __urljudge(eregi_replace("http://", "", $url)); $content = array( message => $message, ip => $Myip, time => time() ); $text_class->add_line($content); function _link($url) { $contents = @file_get_contents("$url"); if ($contents == "Forbidden" || $contents == "") { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, "$url"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $contents = curl_exec($ch); curl_close($ch); } if (empty($contents)) { exit('<font color=red>cant locaion.</font>'); } preg_match_all("/charset=(.*?)>/is", $contents, $cod); if (!empty($cod[1][0])) { if (preg_match("/utf-8/i", $cod[1][0])) { $contents = iconv("UTF-8", "gbk//TRANSLIT", $contents); } } return $contents; } $contents = _link($url); preg_match_all("/<a href=(.*?)<\/a>/is", $contents, $link); foreach ($link[0] as $val) { if (strip_tags($val)) { preg_match_all("/<a href=\"(.*?)\"/is", $val, $link_url); $links[] = $val; if (preg_match("/http/i", $link_url[1][0])) { if (!preg_match("/\$message/i", $link_url[1][0])) { $links_out[] = $link_url[1][0]; $array[] = '<div class=list_left>' . strip_tags($val) . '</div><div class=list_right><a href="' . $link_url[1][0] . '">' . $link_url[1][0] . '</a></div>'; } else { $array[] = '<div class=list_left>' . strip_tags($val) . '</div><div class=list_right><a href="' . $link_url[1][0] . '">' . $link_url[1][0] . '</a></div>'; } } else { if (!preg_match("/^\/(.*?)/", $link_url[1][0])) $link_url[1][0] = '/' . $link_url[1][0]; $array[] = '<div class=list_left>' . strip_tags($val) . '</div><div class=list_right><a href="' . $url . $link_url[1][0] . '">' . $url . $link_url[1][0] . '</a></div>'; } } } if (!empty($link)) { echo "<b>网站:<font color=red>" . $url . "</font></b><br><br>"; echo "<div id=list_top><b>共有链接<font color=red>" . count($links) . "</font>,内链<font color=red>" . (count($links) - count($links_out)) . "</font>,外链<font color=red>" . count($links_out) . "</font></b><br><br></div>"; echo "<a href=" . /">返回查询首页</a>"; } else { echo "<br><br>网站:<font color=red>" . $url . "</font>无法查询,请更换查询地址!"; } ?> <form method="post" id="shoulu"> <div class="pxd13"> 网址:<input type="text" name="message" class="input_1" id="message"> <input type="submit" name="Submity" class="button" value=" 提交 "> </div></form> <?php require_once 'Textclass.php'; $history = $text_class->openFile(); sort($history, SORT_DESC); foreach ($history as $k => $v) { $h[] = $v[0]; } if ($h) $history = array_flip(array_flip($h)); ?> <div id="leftcontent_2"></div> <?php if ($history) { foreach ($history as $val) { echo "<a href=link.php?message=$val class='urls'>" . $val . "</a>"; } } else { echo "<br><p>暂无记录</p>"; } ?> </div>
本文地址:http://www.phprm.com/code/4da0bf5f70be78c3d7ab977ace046d3a.html
转载随意,但请附上文章地址:-)