Friendly link check php implements home page link query code for friendly link check

WBOY
Release: 2016-07-29 08:41:39
Original
2373 people have browsed it

Copy the code The code is as follows:


/*
* Website homepage hyperlink check, friendly link query, external link query
* Original QQ by web technology enthusiast lost63.com: 35501547
* Reposted Please indicate the source
*/
if($_GET['action']=="check"){
$domain=$_POST['domain'];
//If the domain name form item is empty, get the address bar parameters
if($domain==""){
$domain=$_GET['domain'];
}
//Website
$url="http://".$domain;
//Read the web page, Return the content of the web page source file
function read_url($str){
$file=fopen($str,"r") or die($str.'->Remote URL reading failed! Click to continue query
');
while(!feof($file)){
$result.=fgets($file,9999);
}
fclose($file);
return $result;
}
//Open session
session_start();
//If $_SESSION['matches'] is not assigned a value, set it;
if(!isset($_SESSION['matches'])){
$result=read_url($url);
preg_match_all('/(.*?)/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];
}
//Get the 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< /font>
';
}else{
$value=$matches[2][$next].' false
';
}
$ values=$_COOKIE['check_result'].$value;
setcookie("check_result",$values,time()+3600);
echo $values;
if($next==$n){
echo "Scan End!";
}else{
echo '';
}
}else{
//Delete cookies
setcookie("check_result","",time( )-3600);
echo '



< input type="submit" name="Submit" value="Submit">
*Enter the domain name such as: jb51.net
';
}
?>

The above introduces the friendly link check, PHP implementation of home page link query, friendly link check code, including the content of friendly link check, I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!