[問題] 使用jsp來取得FB accessToken內容?

看板Web_Design作者 (阿U)時間12年前 (2013/04/24 14:14), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
我現在想要做使用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
那個函式就是取得$token_url那個網頁的原始碼
04/24 18:41, 1F

06/06 14:53, , 2F
我之前按照http://ppt.cc/qG7k的方法~調了一下有實作出來
06/06 14:53, 2F

06/06 14:54, , 3F
基本上不需要用到什麼套件就可以搞定了~給你參考看看
06/06 14:54, 3F
文章代碼(AID): #1HTtXSMN (Web_Design)