[問題] 使用jsp來取得FB accessToken內容?
我現在想要做使用FB來登入我的網站,
並取得FB照面、姓名即可
使用JSP,使用server side來做access token
目前可以取得Permission和連到 access Token的網址
當我看到facebook的範例中,看到php 的 file_get_contents就不會用了
請問有人用jsp寫過嗎? 到這邊的話使用jsp要如何取得使用者資訊呢?
以下是官網的php範例
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
$_SESSION['access_token'] = $params['access_token'];
$graph_url = "https://graph.facebook.com/me?access_token="
. $params['access_token'];
$user = json_decode(file_get_contents($graph_url));
echo("Hello " . $user->name);
麻煩大家了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 1.168.248.90
→
04/24 18:41, , 1F
04/24 18:41, 1F
→
06/06 14:53, , 2F
06/06 14:53, 2F
→
06/06 14:54, , 3F
06/06 14:54, 3F