Home > php教程 > php手册 > php 采集入库

php 采集入库

WBOY
Release: 2016-06-13 10:47:21
Original
1014 people have browsed it

if($_GET[id] $con=file_get_contents ("http://book.qq.com/lianzaiindex/sort4/index_".$_GET['id'].".htm");
//echo $con; 
$preg = "#

(.*)#iUs"; 
 
preg_match_all($preg,$con,$arr); 
$time=time(); 
 
foreach ($arr[1] as $k=>$v){ 
    echo $v." ".$arr[2][$k]."
"; 
    $sql="insert into  tmp_url (url,title,addtime) values ('".$v."','".$arr[2][$k]."','$time')"; 
    $db->query($sql); 

$_GET['id']++; 
echo  "正在采集www.2cto.com。。。。".$_GET[id]; 
echo "<script>location.href=&#39;stahtml.php?id=".$_GET[id]."&#39;</script>"; 
}else { 
    echo "采集结束"; 


摘自 chaojie2009的专栏
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template