Copy CodeThe code is as follows:
/*
* Website Home hyperlink Reverse Search links query outside the chain
* Web technology Enthusiasts lost63.com original qq:35501547
* Reprint please indicate the source
*/
if ($_get[' action ']== "check") {
$domain =$_post[' domain ';
If the Domain Name table item is empty, get the address bar parameter
if ($domain = = "") {
$domain =$_get[' domain ';
}
Url
$url = "http://". $domain;
Read Web page, return page source file content
function Read_url ($STR) {
$file =fopen ($str, "R") or Die ($str. ' Remote URL read failed! Click Continue Query
');
while (!feof ($file)) {
$result. =fgets ($file, 9999);
}
Fclose ($file);
return $result;
}
Open session
Session_Start ();
If $_session[' matches ' is not assigned, set it;
if (!isset ($_session[' matches ')) {
$result =read_url ($url);
Preg_match_all ('/(. *?) <\/a>/i ', $result, $matches);
$num =count ($matches [2]);
for ($i =0; $i < $num; $i + +) {
if (Strpos ($matches [2][$i], $domain) >0) {
Unset ($matches [2][$i]);
}
}
$_session[' matches ']= $matches [2];
}
Remove the included URL array directly from the session;
$matches [2]=$_session[' matches '];
$n =count ($matches [2]);
$next = 0;
$next +=$_get[' next ';
$result =read_url ($matches [2][$next]);
if (Strpos ($result, $domain) >0) {
$value = $matches [2][$next]. ' True
';
}else{
$value = $matches [2][$next]. ' False
';
}
$values =$_cookie[' Check_result '). $value;
Setcookie ("Check_result", $values, Time () +3600);
Echo $values;
if ($next = = $n) {
echo "Scan over!";
}else{
Echo ' ';
}
}else{
Delete Cookies
Setcookie ("Check_result", "", Time ()-3600);
Echo ';
}
?>
The above describes the link check PHP implementation of the homepage link query links Check the code, including links to check the content, I hope that the PHP tutorial interested friends have helped.