[教學] Facebook API PHP SDK - 基本篇,已經提到基本的 Facebook 觀念,如果需要取得更多資料呢?例如,使用者Email, 貼資料在牆上, 取得朋友列表...等,都需要在使用者登入的時候,就按下允許。
參數說明:
fbconnect:Facebook 連線,恆為1。
canvas:Facebook內的畫布,沒有用到,為0。
next:按下完成後轉向網址。
redirect_uri:下一頁轉向網址。
基本款權限如下圖
加入req_perms = email, publish_stream權限之後,登入權限會變成,如下圖
參考資料
參數說明
$login_url = $facebook->getLoginUrl(array(
'fbconnect' => 1,
'canvas' => 0,
'next' => 'http://localhost/demo/facebook/index.php',
'redirect_uri' => 'http://localhost/demo/facebook/index.php',
));
參數說明:
fbconnect:Facebook 連線,恆為1。
canvas:Facebook內的畫布,沒有用到,為0。
next:按下完成後轉向網址。
redirect_uri:下一頁轉向網址。
基本款權限如下圖
修改參數
$login_url = $facebook->getLoginUrl(array(
'fbconnect' => 1,
'canvas' => 0,
'req_perms' => 'email,publish_stream',
'next' => 'http://localhost/demo/facebook/index.php',
'redirect_uri' => 'http://localhost/demo/facebook/index.php',
));
加入req_perms = email, publish_stream權限之後,登入權限會變成,如下圖
沒錯,如此一來就可以擁有操控權限,是不是非常的容易呢!?
原始碼,自己拉回去改。
原始碼,自己拉回去改。
<?php
require './facebook.php';
$facebook = new Facebook(array(
'appId' => 'yor key',
'secret' => 'your key',
'cookie' => true,
));
$login_url = $facebook->getLoginUrl(array(
'fbconnect' => 1,
'canvas' => 0,
'req_perms' => 'email,publish_stream',
'next' => 'http://localhost/demo/facebook/index.php',
'redirect_uri' => 'http://localhost/demo/facebook/index.php',
));
?>
<h1>Renew a facebook Login URL.</h1>
<ul>
<li><a href="<?php echo $login_url; ?>">Login please press here.</a></li>
</ul>
沙發!
回覆刪除Hey! Do you know if they make any plugins to safeguard against
回覆刪除hackers? I'm kinda paranoid about losing everything I've worked hard on.
Any tips?
Feel free to surf to my web site: think losing weight
In other words, before quitting in 2004 accountant and setting traps
回覆刪除in his paper, and wrote a paper that is hard to miss. If your site accountant automatically, that's right.
Look at the bank in question subsequently raised a new buddy, you will find most
if not apparent from the sites of construction and the
company. Reporting packs for monthly management accounts.
Here is my web blog: web page ()