修改之前请确保网站开启了curl函数。
(1)具体修改如下: phpcms/libs/classes/attachment.class.php 添加了一个函数
(2)找到大概171行代码:
- /*
- ** 采集https内容
- */
- protected static function curl_getpic($file,$newfile) {
- if (!function_exists('curl_init')) {
- throw new Exception('server not install curl');
- }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$file);
- curl_setopt($ch, CURLOPT_HEADER,0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);//禁止调用时就输出获取到的数据
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
- $data = curl_exec($ch);
- curl_close($ch);
- $write = @fopen($newfile,"w");
- fwrite($write,$data);
- fclose($write);
- return TRUE;
- }
改成:
- if($upload_func($file, $newfile)) {
保存测试一下试试!
- if($this->curl_getpic($file, $newfile)) {
此处修改和采集无法采集https网站内容采用方法一样!