<?php
//$url = 'http://www.abcsee.net/book/20/20816/4812262.html';
function getUrlContent($url)
{
$params = array(
'http' => array(
'method' => 'GET',
'header' => "User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1\r\n\r\nReferer:http://www.abcsee.net/book/20/20816/",
));
$response = file_get_contents($url, false, stream_context_create($params));
return $response;
}
for ($i=1; $i < 25000; $i++){
$url = 'http://www.abcsee.net/book-'. $i .'.html';
$bookHtml = getUrlContent($url);
file_put_contents('./book/' . $i .'.html', $bookHtml);
}
?>
抓取信息参考
最新推荐文章于 2021-06-04 11:09:59 发布