Php Facebook api:获取电子邮件
我在使用php从Facebook sdk获取电子邮件地址时遇到问题 错误消息: 注意:未定义变量:中的请求 /第94行的storage/h5/727/1013727/public_html/index.php 致命错误:未捕获错误:调用上的成员函数execute() /storage/h5/727/1013727/public_html/index.php:94堆栈跟踪中为空: 0{main}在上的/storage/h5/727/1013727/public_html/index.php中抛出 第94行 我的代码是:Php Facebook api:获取电子邮件,php,html,facebook-graph-api,facebook-php-sdk,Php,Html,Facebook Graph Api,Facebook Php Sdk,我在使用php从Facebook sdk获取电子邮件地址时遇到问题 错误消息: 注意:未定义变量:中的请求 /第94行的storage/h5/727/1013727/public_html/index.php 致命错误:未捕获错误:调用上的成员函数execute() /storage/h5/727/1013727/public_html/index.php:94堆栈跟踪中为空: 0{main}在上的/storage/h5/727/1013727/public_html/index.php中抛出
<?php
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
$session,
'GET',
'/{email}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
?>
我应该创建一个config.php来加载所有内容吗?如果git上有你知道的东西,因为我在官方网站上找不到,你应该做:
$fb = new \Facebook\Facebook([
'app_id' => '{app-id}',
'app_secret' => '{app-secret}',
'default_graph_version' => 'v2.8',
//'default_access_token' => '{access-token}', // optional
]);
$response = $fb->get('/{user-id}?fields=email', '{access-token}');
$user = $response->getGraphUser();
从官员的角度来看,你应该做:
$fb = new \Facebook\Facebook([
'app_id' => '{app-id}',
'app_secret' => '{app-secret}',
'default_graph_version' => 'v2.8',
//'default_access_token' => '{access-token}', // optional
]);
$response = $fb->get('/{user-id}?fields=email', '{access-token}');
$user = $response->getGraphUser();
检查文件是否存在,文件是否存在功能检查文件是否存在,文件是否存在功能我收到此错误:致命错误:未捕获Facebook\Exceptions\FacebookAuthenticationException:(#803)您请求的某些别名不存在:email in…此错误是因为
电子邮件中的电子邮件不是有效的API调用。您需要调用/{user id}
。请参阅我收到此错误:致命错误:未捕获Facebook\Exceptions\FacebookAuthenticationException:(#803)您请求的某些别名不存在:email in…此错误是因为email
in/email
中的不是有效的API调用。您需要调用/{user id}
。看见