2018-09-28 09:25:06 3331次浏览 4条回答 0 悬赏 10 金钱

接入qq的时候提示未开启curl,百度后已开启curl和openssl,但还是显示该错误,有大神知道不?指点一下!!
`H98WJWMET1V@5JI3_K.png
1.png
问题截图:71SYGPNBUN`4W4$3S7BA@Y.png

补充于 2018-09-28 09:41

前两种图片是phpinfo中开启curl和openssl的截图,最后一张图片是页面提示错误

Warning: file_get_contents(https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=111111111&redirect_uri=http%3A%2F%2Flt.zhoumoyue.com%2Fconnect.php&client_secret=111122228308f26629f1a9264f333444 审核通过&code=5011111111179FCF4A1F6A485042A7): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/wwwroot/shop/vendor/qqlogin/class/URL.class.php on line 49

可能是服务器无法请求https协议
可能未开启curl支持,请尝试开启curl支持,重启web服务器,如果问题仍未解决,请联系我们

补充于 2018-09-28 09:41

不知道网站提问怎么显示图片,抱歉

最佳答案

  • 李先森 发布于 2018-09-28 16:52 举报

    建议你写个请求方法,写到一个公共文件里,以后那个接口要用到都可以调用!
    1.这个是请求参数为json格式的时候:

    /**
     * post方式请求接口信息(参数json)
     * @param  [type] $url         [description]
     * @param  [type] $data_string [description]
     * @return [type]              [description]
     */
    public static function http_post($url, $data_string) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'X-AjaxPro-Method:ShowList',
            'Content-Type: application/json; charset=utf-8',
            'Content-Length: ' . strlen($data_string))
        );
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }
    2.普通post发送请求
    public static function SendByCurl($url, $param){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
        ob_start();
        curl_exec($ch);
        $result = ob_get_contents();
        ob_end_clean();
        curl_close($ch);
        return $result;
    }
    3.get方式
        public static function getCurl($url){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        curl_setopt($ch, CURLOPT_TIMEOUT, 15);
        $result = curl_exec($ch);
        if (!$result) {
            //输出错误信息
            //trigger_error(curl_error($ch));
            return false;
        }
        curl_close($ch);
        return $result;
    }
    
  • 回答于 2018-10-09 09:35 举报

    sorry

  • 回答于 2018-09-28 10:10 举报

    resizeApi.png

    2 条回复
    回复于 2018-09-28 10:11 回复

    严重怀疑你是不是开发人员,基本的富文本图片上传都不会使?哈哈哈哈哈

    回复于 2018-09-28 10:33 回复

    这都被你发现了,哈哈哈哈

  • 回答于 2018-09-28 09:39 举报

    看不到图啊大兄弟~

    2 条回复
    回复于 2018-09-28 09:44 回复

    大佬上传到问题的富文本框后不显示,后补上页面提示问题错误,麻烦再看看

    回复于 2018-09-28 10:04 回复

    你的地址参数有问题吧,URL里怎么还有【审核通过】?去掉试试

您需要登录后才可以回答。登录 | 立即注册
零零零
主管

零零零

注册时间:2018-07-26
最后登录:2021-07-19
在线时长:17小时8分
  • 粉丝1
  • 金钱455
  • 威望0
  • 积分625

热门问题