今天一个客户更换域名后UCenter通讯失败,以为是域名的问题,通过排查发现是开启了HTTPS协议原来没有开启,而UCenter默认没有对HTTPS协议进行读取,所以在抓取数据的时候回抓到错误地址,导致手动复制返回值正确UC却失败,解决方法就是如下
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-opco2VFN-1590563110965)(http://note.youdao.com/yws/res/3046/WEBRESOURCEa959a17a4d7a75b92a51c2b4ddffe75d)]
uc_server/model/misc.php Line 62 function dfopen(){}
$host = $matches['host'];
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80;
// 增加一下代码即可
if(substr($url,0,5)=='https'){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if($cookie){
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
return curl_exec($ch);
}