【发布时间】:2015-04-27 16:44:45
【问题描述】:
多年来,我拥有这段代码来获取特定 Facebook 页面的赞:
$url = 'https://graph.facebook.com/<facebook site id>';
echo json_decode(file_get_contents($url))->{'likes'};
现在我们升级到 PHP 5.6,它停止工作并出现以下错误消息:
Warning: file_get_contents() [function.file-get-contents.php]: SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in <some page> on line 182
Warning: file_get_contents() [function.file-get-contents.php]: Failed to enable crypto in <some site> on line 182
Warning: file_get_contents(https://graph.facebook.com/<facebook site id>) [function.file-get-contents.php]: failed to open stream: operation failed in <some page> on line 182
有没有简单的方法来解决这个问题?
我知道有一个参考答案,但这个答案会禁用 SSL 验证,我不想实现可能的安全漏洞!
【问题讨论】:
标签: php json facebook ssl curl