原理:读取某站点的源文件,再利用正则分析其源代码,得到所有链接
/**********qiushuiwuhen(2002-5-20)***********/
if(empty($url))$url = "http://www.csdn.net/expert/";//设置url
$site=substr($url,0,strpos($url,"/",8));//站点
$base=substr($url,0,strrpos($url,"/")+1);//文件所在目录
$fp = fopen($url, "r" );//打开url
while(!feof($fp))$contents.=fread($fp,1024);//
$pattern="|href=["]?([^ "]+)[" ]|U";
preg_match_all($pattern,$contents, $regArr, PREG_SET_ORDER);//匹配所有href=
for($i=0;$i
if(substr($regArr[$i][1],0,1)=="/")//是否是站点的根目录
echo "link".($i+1).":".$site.$regArr[$i][1]."
";//根目录
else
echo "link".($i+1).":".$base.$regArr[$i][1]."
";//当前目录
else
echo "link".($i+1).":".$regArr[$i][1]."
";//相对路径
}
fclose($fp);
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Notepad++7.3.1
Easy-to-use and free code editor