我想知道是否有人可以帮助我,我正在构建一个使用Laravel-4
的{{1}}应用程序。目前,我已设法获得与Facebook的连接,并可以登录该应用程序。
但是我想根据Facebook API
中是否存在facebook个人资料链接来控制用户去哪里。目前,我已经获得了一个表单,其中包含了他们个人资料的database
并将其插入到数据库中。
这是我的脸谱资料链接:
url
然而,当我向facebook提出请求时,我得到了回复:
https://www.facebook.com/profile.php?id=100006760337073
array(11) {
["id"]=> string(16) "1536122286623101"
["email"]=> string(16) "jack@gmail.com"
["first_name"]=> string(4) "Jack"
["gender"]=> string(4) "male"
["last_name"]=> string(8) "Coldrick"
["link"]=> string(61) "https://www.facebook.com/app_scoped_user_id/1536122286623101/" ["locale"]=> string(5) "en_US"
["name"]=> string(13) "Jack Coldrick"
["timezone"]=> int(1)
["updated_time"]=> string(24) "2014-09-05T16:35:17+0000"
["verified"]=> bool(true)
}
与网址栏中的['link']
不匹配,因此我的逻辑不起作用,因为我正在比较这两个。我想知道在profile link
中存储用户个人资料的最佳方式是什么,以及他们登录时检查db
中是否存在用户个人资料。
非常感谢任何帮助。
这是我的db
controller
有什么方法可以使用public function handleAddFacebook(){
//Make an entry into the winners table of the DB
$facebookWinner = new FacebookWinner();
$facebookWinner->profile_link = Input::get('link');
$facebookWinner->origin = Input::get('origin');
$facebookWinner->destination = Input::get('destination');
$facebookWinner->win_date = date('Y-m-d');
$facebookWinner->save();
return View::make('admin.dashboard');
}
从Facebook请求用户ID?