1

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?

Lix
  • 47,311
  • 12
  • 103
  • 131
Jazib
  • 1,200
  • 1
  • 16
  • 39
  • 3
    I removed the APP_ID and APP_SECRET from your code. You should **NEVER** make your APP_SECRET public - You should reset it immediately by going to the `basic settings` of your application in the [developers app](https://developers.facebook.com/apps). You don't have to post the APP_ID either - unless someone is trying to assist you and see something on the actual application. – Lix Jan 25 '12 at 18:45

4 Answers4

6

You need to have fb_ca_chain_bundle.crt in the same folder as base_facebook.php. You can get it here : certificate

abhilashv
  • 1,418
  • 1
  • 13
  • 18
4

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;
ori
  • 7,817
  • 1
  • 27
  • 31
1

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 downloaded the files from your github. In index.php it shows the login with FB link even when I am logged in. It then took me to approve the app. I approved it. But then it went back again to the same page with Login with FB. I am not seeing the error I see with my /me call but I am not seeing the personal details either. – somnath Dec 26 '12 at 13:31
1

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)

Cosmin Bacanu
  • 507
  • 4
  • 7