Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google应用程序引擎上的PHP SDK 4.0:cURL错误_Php_Facebook_Google App Engine_Curl - Fatal编程技术网

Google应用程序引擎上的PHP SDK 4.0:cURL错误

Google应用程序引擎上的PHP SDK 4.0:cURL错误,php,facebook,google-app-engine,curl,Php,Facebook,Google App Engine,Curl,我正在制作一个在Google App Engine上运行的PHP应用程序,并尝试实现一个Facebook登录 在访问登录网页后,我被重定向到Facebook,在我接受登录应用程序并被重定向后,我收到错误“错误:此curl实现不支持选项10065” 我已经启用了curl_lite,目前正在本地主机上运行它。这是我的密码: <?php session_start(); //Session should be active #region Settings $app_id

我正在制作一个在Google App Engine上运行的PHP应用程序,并尝试实现一个Facebook登录

在访问登录网页后,我被重定向到Facebook,在我接受登录应用程序并被重定向后,我收到错误“错误:此curl实现不支持选项10065”

我已经启用了curl_lite,目前正在本地主机上运行它。这是我的密码:

<?php
session_start(); //Session should be active

#region Settings
$app_id             = 'xxxxxxx';  //Facebook App ID
$app_secret         = 'yyyyyyy'; //Facebook App Secret
$required_scope     = 'public_profile'; //Permissions required
$redirect_url       = 'http://localhost:8080/signup_fb.php'; //FB redirects to this page with a code
#endregion

#region Imports
//include autoload.php from SDK folder, just point to the file like this:
require_once "../libraries/facebook-php-sdk-v4-4.0-dev/autoload.php";

//import required class to the current scope
use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\FacebookRequestException;
use Facebook\GraphUser;
use Facebook\FacebookRedirectLoginHelper;
#endregion

FacebookSession::setDefaultApplication($app_id , $app_secret);
$helper = new FacebookRedirectLoginHelper($redirect_url);

//try to get current user session
try {
    $session = $helper->getSessionFromRedirect();
} catch(FacebookRequestException $ex) {
    die(" Error : " . $ex->getMessage());
} catch(\Exception $ex) {
    die(" Error : " . $ex->getMessage());
}

if ($session){ //if we have the FB session
    $user_profile = (new FacebookRequest($session, 'GET', '/me'))->execute()->getGraphObject(GraphUser::className());
    //do stuff below, save user info to database etc.

    echo $user_profile->getProperty('name');

}else{

    //display login url 
    $login_url = $helper->getLoginUrl( array( 'scope' => $required_scope ) );
    echo '<a href="'.$login_url.'">Login with Facebook</a>';
}

可以理解的是,启用curl_lite(curl接口由urlfetch支持,功能更少)后,您会看到这样的问题。正如另一位评论员所提到的,如果您打算使用box的devserver作为facebook登录流的客户端来运行这种特定的高级功能,那么您肯定应该使用real curl。

它抱怨这一行:。您必须更改SDK或使用真实版本的cURL。您可以使用php.ini文件启用完整cURL,如下所述。你能解决这个问题吗?我也无法让facebook登录与appengine一起工作,这非常令人沮丧……我的回答清楚地解释了这个问题——使用UrlFetch服务的“cURL lite”的功能不足以满足用户想要执行的操作。为此,他们应该遵循我提供的docs链接,该链接解释了如何使cURL能够使用套接字,这可能是必需的。有了PHP运行时,就可以像在虚拟机上一样运行cURL了。我还建议阅读有关托管虚拟机的内容。