Reputation: 1230
I am a newbie in Facebook app development. I chose the PHP SDK since I am comfortable with PHP. After spending some time, I'm still unable to start on the actual app.
<?php
require_once 'facebook.php';
$facebook = new Facebook(
array(
'appId' => 'XXXXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx',
)
);
$user_id = $facebook->getUser();
var_dump($user_id) ;
$userInfo = $facebook->api('/' + $user_id);
echo ' Welcome ' . $userInfo['name'] ;
?>
The above code should simply print the user's name. But its giving the error:
Fatal error: Uncaught CurlException: 77: error setting certificate verify locations: CAfile: C:\wamp\www\fb/fb_ca_chain_bundle.crt CApath: none thrown in C:\wamp\www\fb\base_facebook.php on line 853
What am I doing wrong here?
Upvotes: 1
Views: 7249
Reputation: 517
i have no idea why what I did worked, but I modified base_facebook.php line 978 for me,
from:
if (curl_errno($ch) == 60)
to:
if (curl_errno($ch) == 77 or curl_errno($ch) == 60)
Upvotes: 1
Reputation: 1482
You need to have fb_ca_chain_bundle.crt in the same folder as base_facebook.php. You can get it here : certificate
Upvotes: 6
Reputation: 11
please check my github repo:
https://github.com/kanishkaganguly/Facebook_PHP_SDK
I have also recently started and have uploaded a set of code demonstrating the various functions of the PHP SDK.
Let me know if you find it useful.
Upvotes: 1
Reputation: 7847
Looks like it can't find fb_ca_chain_bundle.crt
, maybe the forward slash needs to be backward slash, so try looking it up and changing it.
If that doesn't work, this might:
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;
Upvotes: 4