版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhongyuchuan147/article/details/53219968
<?php
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL^E_NOTICE^E_WARNING);
echo '
<style type="text/css">
*{ list-style:none; padding:0px; margin:0px; font: 12px arial; }
a{color:#000; text-decoration:none;}
a:hover{color:#fe0000;}
#odiv:hover{width:120px; height:40px; border:1px solid #ccc; background:#ccc; text-align:center; line-height:40px; margin:5px auto;}
.box_title{width:860px; height:40px; margin:15px auto; clear:both; boder:1px; border:1px solid #ccc; line-height:40px;}
.box_cont{width:860px; margin:15px auto; clear:both; line-height:40px;}
.box_cont li{text-align:center; width:60px; height:30px; float:left; margin:5px; boder:1px; border:1px solid #ccc;}
.book-img-text{width:860px; margin:15px auto; clear:both; line-height:40px;}
.book-img-text li{width:200px; overflow:hidden; height:320px; margin:35px; float:left; border:1px solid #ccc;}
.book-img-box, .red-kw{text-align:center;}
.book-img-box h4{text-align:center; width:200px;}
</style>';
echo '<div style="width:360px; height:50px; margin:0 auto; clear:both; boder:1px; border:1px solid #ccc; line-height:40px;">
<li style="text-align:center; width:80px; height:40px; float:left; margin:5px;"><a href="index.php?l=1">全部小说</a></li>
<li style="text-align:center; width:80px; height:40px; float:left ;margin:5px;"><a href="index.php?l=2">人气作品</a></li>
<li style="text-align:center; width:80px; height:40px; float:left ;margin:5px;"><a href="index.php?l=3">最近更新</a></li>
<li style="text-align:center; width:80px; height:40px; float:left ;margin:5px;"><a href="index.php?l=4">点击最多</a></li>
</div>';
echo '<div style="width:860px; height:40px; margin:15px auto; clear:both; boder:1px; border:1px solid #ccc; line-height:40px;">
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=1">玄幻</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=2">奇幻</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=3">武侠</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=4">都市</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=5">职场</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=6">历史</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=7">游戏</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=8">科幻</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=9">灵异</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=10">短篇</a></li>
<li style="text-align:center; width:65px; height:30px; float:left; margin:5px;"> <a href="index.php?fen=11">二次元</a></li>
</div>';
$url=isset($_GET['url'])?$_GET['url']:'http://a.qidian.com/';//默认
//人气作品
$renqi='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=-1&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';
//最近跟新
$zuijin='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=-1&subCateId=-1&orderId=5&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';
//点击最多
$dianji='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=-1&subCateId=-1&orderId=1&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';
//最多推荐
$tuijian='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=-1&subCateId=-1&orderId=2&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';
$number=isset($_GET['l'])?$_GET['l']:'';
if($number==1){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=-1&subCateId=-1&orderId=3&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==2){$url=$renqi;}
if($number==3){$url=$zuijin;}
if($number==4){$url=$dianji;}
$number=isset($_GET['fen'])?$_GET['fen']:'';
if($number==1){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=21&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==2){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=1&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==3){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=2&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==4){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=4&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==5){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=15&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==6){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=5&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==7){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=7&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==8){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=9&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==9){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=10&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==10){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=20076&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if($number==11){$url='http://a.qidian.com/?size=-1&sign=-1&tag=-1&chanId=12&subCateId=-1&orderId=&update=-1&page=1&month=-1&style=1&action=-1&vip=-1';}
if(isset($_GET['api'])){
$content=file_get_contents($url);
$content=explode('book_pic',$content)[1];
$content=explode('opt',$content)[1];
$content=explode('li',$content)[2];
$content=explode('stat-type',$content)[1];
$content=explode('href=',$content)[1];
$content=explode('"',$content)[1];//阅读链接
echo '<div id="odiv" style="width:80px; height:20px; border:1px solid #ccc; text-align:center; line-height:40px; margin:5px auto;"><a href="?url='.$content.'&conten=1">点击阅读</a></div>';
exit;
}
if(isset($_GET['p'])){
$content=file_get_contents($url);
$conten=explode('textbox',$content)[1];
$conten=explode('txtwrap',$conten)[1];
$conten=explode('class="qrRecWrap',$conten)[0];
echo '<div style="width:980px; margin:0 auto; border:1px solide #ccc;">';
echo $conten;
echo '</div>';
exit;
}
if(isset($_GET['conten'])){
$conten=file_get_contents($url);
$content=explode('id="content"',$conten)[1];
$content=explode('like_box',$content)[0];
$content=explode('class="book_opt"',$content)[0];
$content=str_replace(".aspx",".aspx&p=1",$content);
$content=str_replace('href="','href="?url=',$content);
$content=str_replace('width:33%;','width:250px;height:50px;margin:5px;',$content);
echo $content; exit;
$content=explode('box_title"',$content);
// str_replace(".aspx","aspx&p=1",$content);
// var_dump($content); exit;
for($i=0;$i<count($content);$i++){
$content[$i]=str_replace(".aspx",".aspx&api=1",$content[$i]);
$content[$i]=str_replace('href="','href="?url=',$content[$i]);
echo $content[$i];
}
exit;
}
if(isset($_GET['s'])){
echo '
<div style="text-align:center; width:305px; height:30px; margin:5px auto;">
<form action="index.php?s=1" method = "post">
<input type="text" name="url" style="width:205px; height:30px;" plachholder="请输入需要搜索的书本"><input style="height:30px;" type="submit" value="搜索">
</form> </div>';
$url='http://se.qidian.com/?kw='. urlencode($_POST['url']);
$content=file_get_contents($url);
$content=explode('result-list',$content)[1];
$content=explode('page-box',$content)[0];
$content=str_replace(".aspx",".aspx&api=1",$content);
$content=str_replace('href="','href="?url=',$content);
$content=str_replace(".aspx",".aspx&api=1",$content);
$content=explode('data-l1="3">',$content)[1];
echo $content;
exit;
}
echo '
<div style="text-align:center; width:305px; height:30px; margin:5px auto;">
<form action="index.php?s=1" method = "post">
<input type="text" name="url" style="width:205px; height:30px;" plachholder="请输入需要搜索的书本"><input style="height:30px;" type="submit" value="搜索">
</form> </div>';
$content=file_get_contents($url);
$content=explode('main-content-wrap',$content)[1];
$new_book=explode('all-img-list',$content)[1];
$contents=explode('book-mid-info',$new_book);
//所有的小说的名字
echo '<div style="width:1100px; margin:0 auto; border:1px solide #ccc;">';
for($i=1;$i<count($contents)-1;$i++){
$name=explode('class="name"',$contents[$i])[0];
$text=explode('intro">',$contents[$i])[1];
$text=explode('</p>',$text)[0];
$img=explode('class="book-img-box',$contents[$i])[1];
$img=explode('src=',$img)[1];
$img=explode('"',$img)[1];
$url=explode('href',$contents[$i])[1];
$name=explode('/a></h4>',$name)[0];
$name=explode('data-bid=',$name)[1];
$name=explode('"',$name)[2];
$name=explode('<',$name)[0];
$name=explode('>',$name)[1];
$url=explode('"',$url)[1];
$name_list[]=$name;//小说名
$url_list[]=$url;//连接地址
echo '<div style="width:200px; overflow:hidden; height:320px; margin:35px; float:left; border:1px solid #ccc;"><p style=" margin:5px; text-align:center;"><a href="?url='.$url.'&api=1"><img src='.$img.'></a></p><p style=" margin:5px; text-align:center;"><a href="?url='.$url.'&api=1" style="">'.$name."</a></p><p style=' margin:5px; color:#c3c3c3;'>".$text.'</p>'.'</br></div>';
}
echo '</div>';
?>