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?
You need to have fb_ca_chain_bundle.crt in the same folder as base_facebook.php. You can get it here : certificate
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;
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.
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.