解决云帆小说下载阅读器不能下载https网址的问题

解决思路:通过本地PHP环境,把目录页抓取并显示出来,
1、index.php源码如下

';
$info['area_end']='
[\s\S]+?)' : '(?P[\s\S]+)') . $info['area_end']; $newConfig['reg_source_cont'] = str_replace ('(*)', '[\s\S]*?', $newConfig['reg_source_cont']); $newConfig['reg_source_cont'] = preg_replace ('/\\\*([\'\/])/', "\\\\$1", $newConfig['reg_source_cont']); $zzb= $newConfig['reg_source_cont']; $zhengwen= return_preg_match($zzb,$html); if (isset($zhengwen['match'])){ $zhengwen= $zhengwen['match']; }else{ echo '规则可能不对'; } echo $zhengwen; }else{ echo $html; } //echo $html; ?>

2、ny.php源码如下

';
$info['area_end']='
'; $cj=0; $url = $base_url.$_GET["url"]; $UserAgent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; .NET CLR 1.0.3705; .NET CLR 1.1.4322)'; $curl = curl_init(); //创建一个新的CURL资源 curl_setopt($curl, CURLOPT_URL, $url); //设置URL和相应的选项 curl_setopt($curl, CURLOPT_HEADER, 0); //0表示不输出Header,1表示输出 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设定是否显示头信息,1显示,0不显示。 //如果成功只将结果返回,不自动输出任何内容。如果失败返回FALSE curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_ENCODING, ''); //设置编码格式,为空表示支持所有格式的编码 //header中“Accept-Encoding: ”部分的内容,支持的编码格式为:"identity","deflate","gzip"。 curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); //设置这个选项为一个非零值(象 “Location: “)的头,服务器会把它当做HTTP头的一部分发送(注意这是递归的,PHP将发送形如 “Location: “的头)。 $html = curl_exec($curl); //$html = mb_convert_encoding($html ,'utf-8' , 'gbk'); function characet($data){ if( !empty($data) ){ $fileType = mb_detect_encoding($data , array('UTF-8','GBK','LATIN1','BIG5')) ; if( $fileType != 'UTF-8'){ $data = mb_convert_encoding($data ,'utf-8' , $fileType); } } return $data; } $html=characet($html); function return_preg_match($pattern, $content, $reg_key = 'content') { if (is_array($pattern)) { foreach ($pattern as $patt) { if (preg_match('/' . $patt . '/i', $content, $cont)) { $cont = $cont[$reg_key]; break; } else { $cont = false; } } } else { if (preg_match('/' . $pattern . '/i', $content, $cont)) { //$cont = $cont['match']; } else { $cont = false; } } return empty($cont)?'':$cont; } $html=str_replace(' ','',$html); if (!empty($info['area_start']) || !empty($info['area_end'])) { $newConfig['reg_source_cont'] = $info['area_start'] . (!empty($info['area_end']) ? '(?P[\s\S]+?)' : '(?P[\s\S]+)') . $info['area_end']; $newConfig['reg_source_cont'] = str_replace ('(*)', '[\s\S]*?', $newConfig['reg_source_cont']); $newConfig['reg_source_cont'] = preg_replace ('/\\\*([\'\/])/', "\\\\$1", $newConfig['reg_source_cont']); $zzb= $newConfig['reg_source_cont']; $zhengwen= return_preg_match($zzb,$html); if (isset($zhengwen['match'])){ $zhengwen= $zhengwen['match']; }else{ echo '规则可能不对'; } preg_match_all('/[\x{4e00}-\x{9fff}
\:\,\。\……\“\”]+/u', $zhengwen, $matches_1); $str_1 = join('', $matches_1[0]); $str_1=str_replace('<首','',$str_1); echo $str_1; }else{ preg_match_all('/[\x{4e00}-\x{9fff}
\:\,\。\……\“\”]+/u', $html, $matches_1); $str_1 = join('', $matches_1[0]); echo $str_1; } ?>

3、小说下载阅读器中目录页网址填本地网址就可以了

你可能感兴趣的:(php)