作者sing10407 (阿U)
看板Web_Design
标题[问题] 使用jsp来取得FB accessToken内容?
时间Wed Apr 24 14:14:44 2013
我现在想要做使用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
1F:→ Fantasywind:那个函式就是取得$token_url那个网页的原始码 04/24 18:41
3F:→ eric541:基本上不需要用到什麽套件就可以搞定了~给你参考看看 06/06 14:54