All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP实例:精确到每一秒钟的在线人数显示代码_php资料_编程技术
c#中二维数组的使用
ClassWizard的简单应用
按比例微缩图片的一段小小的JS代码_JavaScript技术_编程技术
数据仓库数据建模的几种思路_mssql学习_编程技术
asp.net2.0内置Application对象的应用
PEAR简介_php资料_编程技术
Visual,C#多线程参数传递浅析_.net资料_编程技术
Asp.net中多彩下拉框的实现_[Asp.Net教程]
Visual Studio 2005中Crystal Reports数据源列举
Reading number is top 10 pictures
传销的好处
Summer is most suitable for young people to travel in China5
擦地板的大叔太好了
Rendez-vous Sleep with actress, three days to earn 600000
南昌铁路局攸县车站125户铁路职工微利房终成骗局
9.3阅兵全景图1-抗战老兵和英雄连队梯队
Summer is most suitable for young people to travel in China6
In 2013 hercules Arnold classic2
Earthquake hedge common sense
Original author said, this is the Hengyang people
Download software ranking
WebService在.NET中的实战应用教学视频 → 第1集
Tram sex maniac 2 (H) rar bag7
Desire a peach blossom
apache-tomcat-6.0.33
Visual C++界面编程技术
Boxer's Top ten classic battle7
matrix3
XML+Web+Service开发教程
C#COM编程指南
SP3 for SQL2000
归海一刀 published in(发表于) 2014/2/17 7:37:08 Edit(编辑)
PHP教程:PHP读取某站点的链接的函数_[PHP教程]

PHP教程:PHP读取某站点的链接的函数_[PHP教程]

PHP教程:PHP读取某站点的链接的函数_[PHP教程]


原理:读取某站点的源文件,再利用正则分析其源代码,得到所有链接
if(empty(url))url = "/";//设置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;iif(!eregi("://",regArr[i][1]))//是否是相对路径,即是否还有://
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);
?>

来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.