开发者

How to Post facebook wall automatically with Facebook API (only with userid)

using fconnect user have authenticated and i have saved their userid to my database.

When i try to publish to their wall is redirecting to Facebook login page . If user haven't logged in.

$status = $facebook->api('/MY_USER_ID/feed', 'POST', 
   array('message' => 'This post came from my app.'));

Help me but som开发者_StackOverflow中文版e web app are posting status to my wall without even i havn't logged into facebook.

Please help me to fix it:)


below code helps you to get permissions from user and access the user's information:

$dialog_url = "http://www.facebook.com/dialog/oauth?client_id=". $app_id . "&redirect_uri=" . urlencode($my_url) . "&scope=publish_stream,user_about_me,read_friendlists,offline_access,publish_actions,friends_photos,,user_photos". "&state=" . $_SESSION['state'];

echo("<script> window.location.href='" . $dialog_url . "'</script>");


When your application gets permissions from the user you need to specify you need the offline_access permission using the scope parameter.


You just need to ask for the publish_stream permission and then your code will work. For more about this check this and this answers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜