找回密码
 注册帐号
查看: 1130|回复: 0

DISCUZ开启https后与http网站主应用ucenter通信失败解决方法

[复制链接]
发表于 2017-11-12 15:30:40 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册帐号

×
/uc_server/model/misc.php
  1.                 if(substr($url,0,5)=='https'){
  2.                             $ch = curl_init($url);
  3.                             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  4.                             if($post){
  5.                                     curl_setopt($ch, CURLOPT_POST, 1);
  6.                                     curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  7.                             }
  8.                             if($cookie){
  9.                                     curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  10.                             }
  11.                             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  12.                             return curl_exec($ch);
  13.                     }
复制代码

    function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE    , $ip = '', $timeout = 15, $block = TRUE, $encodetype  = 'URLENCODE') {
        $return = '';
        $matches = parse_url($url);
        $scheme = $matches['scheme'];
        $host = $matches['host'];
        $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
        $port = !empty($matches['port']) ? $matches['port'] : 80;

填写以上代码

        if($post) {
            $out = ";POST $path HTTP/1.0\r\n";
            $header = "Accept: */*\r\n";
            $header .= "Accept-Language: zh-cn\r\n";
            $boundary = $encodetype == 'URLENCODE' ? '' : ';'.substr($post, 0, trim(strpos($post, "\n")));
            $header .= $encodetype == 'URLENCODE' ? "Content-Type: application/x-www-form-urlencoded\r\n" : "Content-Type: multipart/form-data$boundary\r\n";
            $header .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
            $header .= "Host: $host:$port\r\n";
            $header .= 'Content-Length: '.strlen($post)."\r\n";
            $header .= "Connection: Close\r\n";
            $header .= "Cache-Control: no-cache\r\n";
            $header .= "Cookie: $cookie\r\n\r\n";
            $out .= $header.$post;
欢迎来到安全之家
悄悄告诉你善用本站的【 搜索 】功能,那里可能会有你要找的答案哦
您需要登录后才可以回帖 登录 | 注册帐号

本版积分规则

Archiver|sitemap|小黑屋|手机版原版|安全之家

GMT+8, 2025-4-11 05:14 , Processed in 0.031811 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表