posting message from my site to facebook wall
I am trying to post message on facebook wall . i tried with developer.facebok and the settigns in that asking for site to which i have to link .actually am working on local now and site is not published in a server. how can i post to facebook wall from my loca开发者_如何学JAVAl mechine.
var body = 'Reading Connect JS documentation';
FB.api('/me/feed', 'post', { message: body }, function(response)
{
if (!response || response.error)
{
alert('Error occured');
}
else
{
alert('Post ID: ' + response.id);
}
});
I'd suggest alerting the response.error instead of the static string, or set a debugger; point there and look at the value.
Also look at the network traffic and check out the response stream if those don't work.
To post to a wall even after the user left your app (but still left the permissions accepted for publish_stream), then you can just user your app id/secret to post as them. From https://developers.facebook.com/docs/reference/api/permissions/
Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends. With this permission, you can publish content to a user's feed at any time, without requiring offline_access. However, please note that Facebook recommends a user-initiated sharing model.
精彩评论