2011-09-10 26 views
0

我知道里面有幾個免費的應用程序,讓您的設施,如果用戶是風扇轉到xyz.php程序或顯示圖像。如果用戶點擊「like」,則轉到vwx.php程序或顯示圖像。我一直在嘗試使用php facebook應用程序中使用FB.Event.subscribe的免費應用程序,但我已經厭倦了嘗試。我知道它應該是這麼簡單:開發一個應用程序的iframe選項卡

如果用戶是風扇 {location.href = 'xyz.php'} 其他{location.href = 'vwx.php'}

BUT我怎麼知道用戶是否是粉絲

請幫忙!!! 感謝

回答

1

你應該熟悉* signed_request *參數:

http://developers.facebook.com/docs/authentication/signed_request/

如果向下滾動頁面,你會發現一個PHP函數,說明了如何驗證和解碼* signed_request *。

功能添加到您的代碼,並調用它像這樣:

$data = parse_signed_request($_REQUEST['signed_request'],'YOUR_APP_SECRET'); 

現在,您可以訪問的對象在signed_request爲PHP數組:

if($data['page']['liked']) { //show content for fans } 
else { //show content for others } 
相關問題