PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

一夜缠情 女人 要定你 txt php 采集书并合成txt格式的实现代码

原创
2016-07-29 08:39:27 963浏览

/**
* @name 采集书.php
* @date Sun Mar 01 22:48:02 CST 2009
* @copyright 马永占(MyZ)
* @author 马永占(MyZ)
* @link http://blog.csdn.net/mayongzhan/
*/
//header('Content-Type:text/html;charset=utf8');
header('Content-Type:text/html;charset=gb2312');
error_reporting(E_ALL);
date_default_timezone_set('Asia/Shanghai');
set_time_limit(0);
function writer($content,$url)
{
$fp = fopen($url, 'ab');
fwrite($fp, $content);
fclose($fp);
}
$folder = '2'; //文件夹
$book_base_url = 'xxxxxxxxxxxxxxxxxxxxx';
$book_url = 'yyyyyyyyyyyyy.html';
$main = file_get_contents($book_base_url.$book_url);
preg_match_all('/chapter_.*?\.html/', $main, $pages);
$pages = array_unique($pages[0]);
foreach ($pages as $value) {
writer(file_get_contents($book_base_url.$value), './'.$folder.'//m.sbmmt.com/m/'.$value.'.txt');
$str = file_get_contents('./'.$folder.'//m.sbmmt.com/m/'.$value.'.txt');
//print_r($str);
preg_match("/(

)(.*?)()(.*?)(

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。