用户订阅的php facebook查询

时间:2014-12-16 15:13:10

标签: facebook facebook-graph-api facebook-opengraph opengraph

我正在尝试使用openGraph确定用户是否订阅了我的APP。

我遵循这里提到的内容:https://developers.facebook.com/docs/payments/subscriptions/tutorial#server-side

但每次我收到此错误:

Fatal error: Uncaught exception 'Facebook\FacebookAuthorizationException' with message '(#803) Some of the aliases you requested do not exist: v2.0https:' in /home/......

我的代码是:

<?php
@session_start();
ini_set('display_errors','On');

require_once($_SERVER['DOCUMENT_ROOT'].'/includes/fb-sdk/fb-data.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/includes/functions.inc.php');

// Facebook app settings
$app_id = FB_APPID;
$app_secret = FB_SECRET;



// Autoload the required files
require_once($_SERVER['DOCUMENT_ROOT'].'/includes/fb-files/autoload.php' );



use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\GraphObject;
use Facebook\GraphUser;
use Facebook\GraphUserPage;


// Initialize the SDK
FacebookSession::setDefaultApplication( $app_id, $app_secret );


$session = new FacebookSession($_SESSION['fb_'.FB_APPID.'_access_token']);


$url = 'https://graph.facebook.com/10000********34/payment.subscriptions';

$response = (new Facebook\FacebookRequest(
    $session, 'GET', $url
))->execute();

print_r($response);
?>

1 个答案:

答案 0 :(得分:1)

the SDK will handle this for you以来,您不应该传递https://graph.facebook.com/。您应该只传递您呼叫的端点:/USER_ID/payment.subscriptions