0

I read lots of questions which are related to my problem. However, I can't resolve it. The getUser() from Facebook-php-sdk always return 0 though I logged in. From my log:

Invalid or no certificate authority found, using bundled information

I added "CURLOPT_SSL_VERIFYPEER => FALSE" to BaseFacebook::$CURL_OPTS. However, it's not working.

My code:

<?php

try {
            $facebook = new Social\Facebook ();
            $user_fb_id = $facebook->getUser();

            if ($user_fb_id) {

                //do something
            } else {
                $params = array(
                        'scope' => 'email, user_activities, read_stream, publish_stream, user_birthday, user_likes',
                        //'display' => 'touch',
                        'redirect_uri' => Uri::base(false) . 'userjob/login?url=' . $url
                );
                $login_url = $facebook->getLoginUrl($params);
                Response::redirect($login_url);
            }
        } 
catch (Exception $e) {

            echo "Error";
            echo $e->getMessage();
            die();
   }

By the way, I use PHP5.3.2 (MAMP 1.9, MAC OS 10.7.5), the above code working fine on the other computers and working on the localhost to connect with Facebook. However, It's failed on my computer.

Update: (Solved) 

Thank you all for helping me! The problem is my hosts file. I clear some old IPs which are related to Facebook and it's working!

secretlm
  • 2,361
  • 2
  • 27
  • 38

1 Answers1

0

Have a look at the accepted answer here: Facebook application development using PHP SDK

It seems like you're missing the FB certificate file.

Community
  • 1
  • 1
Tobi
  • 31,405
  • 8
  • 58
  • 90