Facebook PHP SDK - getUser() suddenly returns 0

前端 未结 4 1583
Happy的楠姐
Happy的楠姐 2021-01-12 06:31

First of all, to get this out of the way, I\'ve spent hours looking through answers to this question here on StackOverflow, and tried to solve it on my own, but it just isn\

4条回答
  •  青春惊慌失措
    2021-01-12 06:53

    In base_facebook.php add the following 2 lines under $CURL_OPTS:

    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => 2
    

    Which makes it...

    public static $CURL_OPTS = array(
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 60,
        CURLOPT_USERAGENT      => 'facebook-php-3.2',
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_SSL_VERIFYHOST => 2
      );
    

    I'm not sure how much of a security issue this is, but it makes the Login with Facebook work, so there you have it.

    EDIT: New SDK released which fixes this problem: https://github.com/facebook/facebook-php-sdk

提交回复
热议问题