Suggest Page to friends using PHP-SDK

后端 未结 2 812
执笔经年
执笔经年 2020-12-12 07:38

How to implement \"Suggest MY-PAGE to friends\" using PHP-SDK or using Javascript SDK?

2条回答
  •  情深已故
    2020-12-12 08:20

    The earlier solution I have posted is using the PHP SDK method.

    Using JavaScript SDK, you can have a HTML button using onclick attribute to call a function.

    
    

    Inside share function, the method property is compulsory and the other properties (link, picture, name, caption, description) are optional. The value "feed" in method property refers to feed dialog which you need, there are other values for method property such as "apprequests" (Request Dialog) and "send" (Send Dialog). For more information, check out http://developers.facebook.com/docs/reference/dialogs/

    
    

    The difference between PHP SDK and JavaScript SDK

    For PHP SDK, the default message specified in postToWall.php will be posted straight to the user's wall upon clicking the share button. You have to redirect user to postToWall.php first and then redirects him/her back to your application page.

    For JavaScript SDK, a window will pop up upon clicking the share button and user will be able to input their own message before he/she sends it. No additional redirection will be needed after sending as user is still on the same page.

    P.S.: I'm still learning Facebook and PHP at the moment, so do correct me if I am making any mistake haha. Thanks =)

提交回复
热议问题