截获网站<title></title>内容的例子

参考:http://www.netasp.com.cn/valley/gettitle/index.php

代码如下:

 1<pre>   
 2<?   
 3//get_title.php   
 4$file=file("http://www.netasp.com.cn");   
 5$count=count($file);   
 6  
 7for($i=0;$i<$count;$i++){   
 8if(eregi("<title>(.*)",$file[$i],$out)){   
 9$title=$out[0];   
10}   
11}   
12  
13$title=substr($title,7,-8);   
14echo $title;   
15?&gt;   
16</pre>

【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】

Published At
Categories with Web编程
Tagged with
comments powered by Disqus