Ankit Kedia
Ankit Kedia

Reputation: 7

Facebook PHP SDK - Throws exception when trying to fetch profile data

Below is the part of exception object that I get when trying to fetch logged in users profile data

PHP Code

$user = $facebook->api('/me');

Exception that I get

object(FacebookApiException)#3 (7) {
  ["result:protected"]=>
  array(2) {
    ["error_code"]=>
    int(77)
    ["error"]=>
    array(2) {
      ["message"]=>
      string(104) "error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
"
      ["type"]=>
      string(13) "CurlException"
    }
  }
  ["message:protected"]=>
  string(104) "error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
"

Any suggestion?

Upvotes: 0

Views: 1260

Answers (2)

phwd
phwd

Reputation: 19995

Recheck that you have the certificate in the the src folder

https://github.com/facebook/php-sdk/blob/master/src/fb_ca_chain_bundle.crt

Upvotes: 2

Smita
Smita

Reputation: 4634

this looks like a problem with CURL is unable to write to your ssl folder, one workaround may be try to force curl to not establish secure connection. something like this you can do:

curl_setopt($url, CURLOPT_SSL_VERIFYPEER, FALSE);

OR

echo insecure >> ~/.curlrc

Upvotes: 2

Related Questions