我是在本地配置的服务器,用的集成环境软件phpStudy
解决方案 »
- php分页类的问题
- 数据库设计的疑点
- 怎么把Discuz!X中的登录功能提取出来
- php中 charset 与set names本质区别
- 正在做个网站,遇到了点麻烦,本人对php不是很了解,希望大家给点帮助
- 死的心都有了 Fatal error: Call to undefined function mysql_connect()
- apache怎样让它支持php呢
- 关于站点获取另外一个站点下的cookie问题
- %%***个人网站终于完工,请多多提意见哦,谢谢你
- 谁有用户注册系统的PHP源代码,高分求购!男女我用两个单选按钮,请问怎样写代码?
- php注册码
- 类中调用自定义方法怎么会Fatal error: Call to undefined function
[Mon Aug 11 17:31:31.617187 2014] [core:error] [pid 13256:tid 8396] [client ::1:64737] End of script output before headers: book_Mu_cj.php, referer: http://localhost/cmd/book_MuCj_set.php
[Mon Aug 11 17:44:43.753906 2014] [core:error] [pid 4400:tid 8492] [client ::1:50407] End of script output before headers: book_Mu_cj.php, referer: http://localhost/cmd/book_MuCj_set.php
[Mon Aug 11 17:44:54.285156 2014] [fcgid:warn] [pid 4400:tid 452] mod_fcgid: process 11056 graceful kill fail, sending SIGKILL
[Mon Aug 11 17:45:39.821289 2014] [core:warn] [pid 8596:tid 416] AH00098: pid file C:/phpStudy/Apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Aug 11 17:45:40.248046 2014] [ssl:warn] [pid 8596:tid 416] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Aug 11 17:45:40.249023 2014] [mpm_winnt:notice] [pid 8596:tid 416] AH00455: Apache/2.4.3 (Win32) OpenSSL/1.0.1c mod_fcgid/2.3.7 configured -- resuming normal operations
[Mon Aug 11 17:45:40.249023 2014] [mpm_winnt:notice] [pid 8596:tid 416] AH00456: Server built: Aug 17 2012 21:41:09
[Mon Aug 11 17:45:40.249023 2014] [core:notice] [pid 8596:tid 416] AH00094: Command line: 'C:\\phpStudy\\Apache\\bin\\httpd.exe -d C:/phpStudy/Apache'
[Mon Aug 11 17:45:40.250000 2014] [mpm_winnt:notice] [pid 8596:tid 416] AH00418: Parent: Created child process 12860
[Mon Aug 11 17:45:41.574218 2014] [ssl:warn] [pid 12860:tid 308] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Aug 11 17:45:41.578125 2014] [mpm_winnt:notice] [pid 12860:tid 308] AH00354: Child: Starting 1000 worker threads.
[Mon Aug 11 17:46:24.898437 2014] [fcgid:warn] [pid 12860:tid 8496] [client ::1:51048] mod_fcgid: read timeout from pipe, referer: http://localhost/cmd/book_MuCj_set.php
[Mon Aug 11 17:46:24.898437 2014] [core:error] [pid 12860:tid 8496] [client ::1:51048] End of script output before headers: book_Mu_cj.php, referer: http://localhost/cmd/book_MuCj_set.php
[Mon Aug 11 17:46:35.575195 2014] [fcgid:warn] [pid 12860:tid 452] mod_fcgid: process 13424 graceful kill fail, sending SIGKILL
{
//采集到第几页,并写入到数据库-------------------
$result =$db->update('mucjset', array( 'zzformula' => $j,
'updateTime' => date('Y-m-d H:i:s')
),"cid='$_GET[cid]'");
//-------------------------------------------
$fp = @ fopen($url, "r"); //得到目录页源码
$fcontents = file_get_contents($url); //获取远程文件内容
$fcontents = iconv("GBK","UTF-8//IGNORE",$fcontents); //把GB2312码的字符串转换成UTF8函数
$num1=strpos($fcontents,$fbegin);//得到开始位置
$num2=strpos($fcontents,$fend);//得到结束位置
$fcontents=substr($fcontents,$num1,$num2-$num1+$flen); //得到截取位置
preg_match_all('/<a[^>]+href="([^"]+)"[^>]+class="green"[^>]+/Ui',$fcontents,$reg);//查找数字符串并得返回数组
$math = $reg[1];//得到实用数组
$count = count($math);//得到数组长度,数组是从0开始的
for ($i=0; $i<=$count-1; $i++) //遍历数组
{
$zurl = $zzurl.$math[$i]; //得到内容页URL网址
$zfp = @ fopen($zurl, "r"); //得到内容页源码
$zfcontents = file_get_contents($zurl); //获取远程文件内容
$zfcontents = iconv("gbk","UTF-8//IGNORE",$zfcontents); //把gbk码的字符串转换成UTF8
//采集标题
$tbegin = strlen($cjset['ztbegin']);//得到内容页开始位置字符串的长
$tnum1=strpos($zfcontents,$cjset['ztbegin'])+$tbegin;//得到内容页开始位置
$tnum2=strpos($zfcontents,$cjset['ztend']);//得到内容页结束位置
$title=substr($zfcontents,$tnum1,$tnum2-$tnum1); //得到内容页截取内
$wtitle = $db->get_one("SELECT * FROM news where title='$title' LIMIT 1");
if($wtitle['title']==$title)
{
continue;
}
//采集简介
$zjbegin = strlen($cjset['zjbegin']);//得到内容页开始位置字符串的长
$jnum1=strpos($zfcontents,$cjset['zjbegin'])+$zjbegin;//得到内容页简介开始位置
$jnum2=strpos($zfcontents,$cjset['zjend']);//得到内容页简介结束位置
$zj=substr($zfcontents,$jnum1,$jnum2-$jnum1); //得到内容页简介
//采集作者
$zzbegin = strlen($cjset['zzbegin']);//得到内容页开始位置字符串的长
$znum1=strpos($zfcontents,$cjset['zzbegin'])+$zzbegin;//得到内容页作者开始位置
$znum2=strpos($zfcontents,$cjset['zzend']);//得到内容页作者结束位置
$zz=substr($zfcontents,$znum1,$znum2-$znum1); //得到内容页作者
//采集图片
$zibegin = strlen($cjset['zibegin']);//得到内容页开始位置字符串的长
$inum1=strpos($zfcontents,$cjset['zibegin'])+$zibegin;//得到内容页作者开始位置
$inum2=strpos($zfcontents,$cjset['ziend']);//得到内容页图片结束位置
$zi=substr($zfcontents,$inum1,$inum2-$inum1); //得到内容页图片
preg_match_all("/<img src=\"(.*)\" alt=/",$zi,$ZImg);//查找数字符串并得返回数组,获得图片地址
$mimg = $ZImg[1];//得到实用数组,获得图片地址
//$img=GrabImage($mimg[0],""); //下载图片,并保存
//将采集的小说目录插入到数据库
$result =$db->insert('news', array(
'title' => $title,
'content' => $zj,
'author' => $zz,
'img' => basename($mimg[0]),
'imgUrl' => $mimg[0],
'status' => "连载中",
'ku' => $cjset['category'],
'cid' => $info['cid'],
'zid' => $info['cid'],
'updateTime' =>date('Y-m-d H:i:s')
));
//返回结果
sleep(3);
}
$url=$furl."/index_".($j+1).".html";
}
估计这里慢。
set_time_limit(0);另外,配置文件中,还有个允许执行的最大时间。