我想在我的本地主机环境中使用HTTPS与Kohana,但它一直抛出以下错误,有谁知道如何解决这个问题?验证SSL证书与Kohana失败
Request_Exception [ 0 ]: Error fetching remote /protected/someFunctionCall.json [ status 0 ] SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
我邮寄请求建立像这样:
$url = "https://www.foobar.com:18443";
$data = http_build_query($params);
// This uses POST - http://kohanaframework.org/3.2/guide/kohana/requests#external-requests
$request = Request::factory($url)
->method(Request::POST)
->body($data)
->headers('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
$response = $request->execute();
我已经产生与OpenSSL的这个指南我的自签名证书:
(西蒙的回答):How do I allow HTTPS for Apache on localhost?
是的,我设法通过curl将上面的'CURLOPT_SSL_VERIFYPEER'变量设置为false来做SSL POST请求。但这不是一个理想的解决方案。 – diggersworld 2012-03-21 17:27:16
是的,正确的方法是告诉客户它可以信任哪些证书。用cURL你可以做到这一点。我已经添加了一些示例代码。 – PhilR 2012-03-21 17:48:30