Itunes验证收据SSL证书错误

时间:2015-12-23 09:08:07

标签: php ios curl in-app-purchase ssl-certificate

我无法在生产环境(https://buy.itunes.apple.com/verifyReceipt)中通过ios应用内购买验证收据

似乎我的服务器没有好的证书。

$ch = curl_init("https://buy.itunes.apple.com/verifyReceipt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$response = curl_exec($ch);

此代码抛出异常:

SSL certificate problem, verify that the CA cert is OK. 
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

我试图从http://curl.haxx.se/docs/caextract.html

手动设置证书
$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO,'/var/cert/ca-bundle.crt');
$response = curl_exec($ch);

但这不会改变。

你有想法解决这个问题吗?感谢

0 个答案:

没有答案