Facebook积分,如何让PHP回来?

时间:2011-09-23 17:47:28

标签: php javascript facebook

我正在使用facebook credits example,但一切正常,但是:

if ($_GET['order_id'] && $_GET['status']) {
$html = "Transaction Completed! </br></br>"
  ."Data returned from Facebookkkkkk: </br>"
  ."<b>Order ID: </b>" . $_GET['order_id'] . "</br>"
  ."<b>Status: </b>" . $_GET['status'];
} elseif ($_GET['error_code'] && $_GET['error_message']) {
$html = "Transaction Failed! </br></br>"
  ."Error message returned from Facebook:</br>"
  .$_GET['error_message'];
}

看起来像$order_id,而$status未被传回。

我真正需要的是将表单中的变量传递回php,以便将它们放入数据库中。

任何想法?

感谢

1 个答案:

答案 0 :(得分:0)

要获得这些,您通常需要这样:

$secret = 'YOUR_APP_SECRET';
$request = parse_signed_request($_REQUEST['signed_request'], $secret);
$payload = $request['credits'];
$order_id = $payload['order_id'];
$func = $_REQUEST['method'];
if ($func == 'payments_status_update')
  $status = $payload['status'];