Home >Backend Development >PHP Tutorial >PHP friendly link batch query tool download_PHP tutorial
Friendly links are commonly used by webmasters. If there are too many network connections, it will be troublesome to check them one by one. For convenience, we provide PHP friendly links and batch query programs. You only need to enter the friendly links to query.
Friendly links are commonly used by webmasters. If there are too many connections to a network, it will be troublesome to check them one by one. For convenience, we provide php friendly links and batch query programs. Just enter the friendly links to query. oh.
$max_allow_links = 100; // Maximum number of allowed links to check
// This function is reprinted from www.lian123.com, special thanks to
function my_file_get_contents($url, $timeout=30) {
if ( function_exists('curl_init') ) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
} else if ( ini_get('allow_url_fopen') == 1 || strtolower(ini_get('allow_url_fopen')) == 'on' ) {
$file_contents = @file_get_contents($url);
} else {
$file_contents = '';
}
return $file_contents;
}
// Start checking
if( isset($_GET['mod']) && $ _GET['mod'] == 'check_now' && isset($_GET['id']) && isset($_GET['my_url']) && isset($_GET['url']) && isset($_GET[ 'auto_check']) ){
$js_id = 'parent.document.getElementById("s_' . $_GET['id'] . '").innerHTML';
if( strstr($_GET[' url'],$_GET['my_url']) ) {
echo '<script>' . $js_id . ' = "Internal link";</script>';
} else if( !stristr($_GET['url'],'http://') ) {
echo '<script>' . $js_id . ' = "Bad link";</script>';
} else {
$s = my_file_get_contents($_GET['url']);
if( trim($s) == '' ){
echo '';
} else {
echo '< script>' . $js_id . ' = "No link found, please check";';
}
}
if($_GET['auto_check']==1){
echo '<script>parent.checkLink(' . ($_GET['id']+1) . ');</script> ';
}
exit('
done!');
}
?>
// Display the obtained link address
if( isset($_POST['html_code']) && isset($_POST['my_url']) ){
preg_match_all("/]{1,}/isU",stripslashes($_POST['html_code']),$ary);
if( isset($ary[1]) && count($ary[ 1])>0 ){
echo '
Start checking Check whether the following URL contains a link of ' . $_POST['my_url'] . ' | |||||||||
Serial number | Checked URL | Check result | |||||||
' . ($i+1) . '. | ' . $ary[1][$i] . ' | ' . $check_str . ' |
if( $_POST['auto_check']==1 ){
echo '<script>autoCheckLink(0);</script>';
}
}
?>
if(isset($_POST['html_code'])){
echo '
我的友情连接: | |||||||||
Hao123 | 265 | 百度网址 | 建网站 | 雅虎网址 | baidu |
Google导航 | |||
搜狗网址 | |||||||||
其他测试链接: 163内部链接测试 |
body>