I’m getting started with the facebook API.
I downloaded the example code from facebook, configured with my appID and secret keys.
<?php
require '../src/facebook.php';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => '...',
'secret' => '....',
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
// This call will always work since we are fetching public data.
$naitik = $facebook->api('/naitik');
?>
on localhost,the script work with no errors. But on host I getting the following error:
Invalid or no certificate authority found, using bundled information
the .crt file was uploaded with success
one may point out my error?
thanks in advance.
Set the option in CURL to point to your certificate file
This option will tell CURL that your
fb_ca_chain_bundle.crtfile is in the same folder as your script.In base_facebook.php line 844 curl_exec fails and the error is generated. Then the script sets:
and tries again.
The Second time all is well, there is no problem it just makes a mess of your log
DO NOT use
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;Or a man-in-middle will be able to intercept your call!