60:SSL证书:证书chainbool中的自签名证书 [英] 60: SSL certificate: self signed certificate in certificate chainbool

查看:420
本文介绍了60:SSL证书:证书chainbool中的自签名证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用我的正确APP_ID,APP_SECRET等发送curl请求到

I try to send curl request with my correct APP_ID, APP_SECRET etc. to the

  https://oauth.vk.com/access_token?client_id=APP_ID&client_secret=APP_SECRET&code=7a6fa4dff77a228eeda56603b8f53806c883f011c40b72630bb50df056f6479e52a&redirect_uri=REDIRECT_URI 



需要从它获取access_token,但得到一个FALSE和 curl_error()打印下一条消息否则:

I need to get access_token from it, but get a FALSE and curl_error() print next message otherwise:

60: SSL certificate problem: self signed certificate in certificate chain

我的代码是:

    // create curl resource
    $ch = curl_init();

    // set url
    curl_setopt($ch, CURLOPT_URL, $url);
    //return the transfer as a string
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    // $output contains the output string
    $output = curl_exec($ch);
    if ( ! $output) {
        print curl_errno($ch) .': '. curl_error($ch);
    }

    // close curl resource to free up system resources
    curl_close($ch);

    return $output;

当我手动移动到上面的链接,我得到access_token很好。为什么它不工作curl?

When I move manually to the link above, I get access_token well. Why it doesn't work with curl? Help, please.

推荐答案

由于协议是https,因此对于开发模式 curl选项以避免ssl验证错误作为快速解决方案。

Since the protocol is https, For the development mode you can set this curl option to avoid ssl verification errors as a quick solution.

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

但对于您的生产环境,不要使用此简单修复进行部署。它会导致一个安全问题,因为数据传输在网络层之间是透明的。请参阅以下网址中的正确修复部分:

But for your production environment, do not deploy with this easy fix. It will cause you a security issue as the data transfer will be transparent among the network layers. See the section proper fix from the following url:

http://unitstep.net/blog/2009/05/05/using-curl- in-php-to-access-https-ssltls-protected-sites /

这篇关于60:SSL证书:证书chainbool中的自签名证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆