cURL issues with HTTPS and Facebook Graph API

2019-08-15 19:29发布

问题:

I'm trying to connect to Facebook's graph api using the PHP-SDK. The session is being created fine, however I'm getting the following error

Fatal error: Uncaught CurlException: 1: Protocol https not supported or disabled in libcurl thrown in .../app/vendors/facebook/graph/facebook.php on line 622

I have tried to correct this by adding the following lines to facebook.php at line 600

$opts[CURLOPT_SSL_VERIFYPEER] = false;
$opts[CURLOPT_SSL_VERIFYHOST] = 0;

to disable the SSL checking, but I am still getting the same error. How can I fix this issue so that I can interact with the FB api? Do I need to recompile cURL or should I add a certificate for FB?

回答1:

It looks like your version of PHP hasn't been compiled with SSL support. (Always verify the peer certificate and the host name when using HTTPS, by the way).