「自学哈网」帝国CMS后台采集不支持HTTPS(帝国cms采集图文教程)
帝国CMS模板网就来告诉大家帝国CMS后台采集支持https开头的协议的方法:
修改:/e/class/connect.php文件
在该文件最上面加上以下函数
//获取https链接内容
functiongetHTTPS($url){
$ch=curl_init();
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch,CURLOPT_HEADER,false);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_REFERER,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
$result=curl_exec($ch);
curl_close($ch);
return$result;
}
找到ReadFiletext函数如下代码:
functionReadFiletext($filepath){
$filepath=trim($filepath);
$htmlfp=@fopen($filepath,"r");
//远程
if(strstr($filepath,"://"))
{
while($data=@fread($htmlfp,500000))
{
$string.=$data;
}
}
//本地
else
{
$string=@fread($htmlfp,@filesize($filepath));
}
@fclose($htmlfp);
return$string;
}
改成:
functionReadFiletext($filepath){
$filepath=trim($filepath);
$htmlfp=@fopen($filepath,"r");
//远程
if(strstr($filepath,"https://")){
returngetHTTPS($filepath);
}
if(strstr($filepath,"://"))
{
while($data=@fread($htmlfp,500000))
{
$string.=$data;
}
}
//本地
else
{
$string=@fread($htmlfp,@filesize($filepath));
}
@fclose($htmlfp);
return$string;
}
完成以上的修改流程步骤,自此可实现采集https开头的网页链接!
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!
自学哈网 » 「自学哈网」帝国CMS后台采集不支持HTTPS(帝国cms采集图文教程)