doulao1934 2014-07-02 16:00
浏览 25
已采纳

SSL证书 - 第三方

I am working with Rightmove and their realtime data feed, we received a (self-signed?) certificate (.p12 file) that we had to insert into our browser/PC to connect to the testserver, this is all working great.

Now we are writing our own script, and connecting to the test server via CURL, however we are loading this script from our server and it does not have access to the test server (handshake failed - authentication, after research looks like it is expecting certificate which makes sense), but how do we get access? They are not of great help and I am wondering if we need to add this certificate to our domain/server as well to gain authentication?

Hope you can help!

  • 写回答

1条回答 默认 最新

  • dtj4307 2014-07-02 16:12
    关注

    You would use the CURLOPT_SSLCERT & CURLOPT_SSLCERTPASSWD options with your CURL command. e.g

    $url = "https://www.example.com";
    $cert_file = 'certificate_file.pem';
    $cert_password = 'password';
    
    $ch = curl_init();
    
    $options = array( 
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
    
        CURLOPT_USERAGENT => 'Useragent',
        CURLOPT_URL => $url ,
        CURLOPT_SSLCERT => $cert_file ,
        CURLOPT_SSLCERTPASSWD => $cert_password ,
    );
    
    curl_setopt_array($ch , $options);
    
    $output = curl_exec($ch);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器