phpcmsv9采集功能不能用怎么办?
无法采集https的网站内容主要是https不支持file_get_contents获取内容,所以可以考虑采用curl的方式获取。(需要开启curl,可以在pathinfo里边查看)
(1)打开phpcms\modules\collection\classes\collection.class.php
在类里边添加新函数:
protectedstaticfunctioncurl_request($url){if(!function_exists('curl_init')){thrownewException('servernotinstallcurl');}$ch=curl_init();curl_setopt($ch,CURLOPT_URL,$url);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);$result=curl_exec($ch);curl_close($ch);return$result;}