Log in

View Full Version : Facebook post on user's wall



ankush
03-06-2013, 05:25 AM
hi,

i am asking for publish_stream permission from user when they are trying to login on my website with facebook. Now i want to post on user's wall.

i am using below code but this code require me to login on facebook and posting on my wall only, please tell me how to post on user's wall?


<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Feed Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a style="cursor:pointer" onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>

<script>
FB.init({appId: "APP ID", status: true, cookie: true});

function postToFeed() {

// calling the API ...
var obj = {
method: 'feed',
redirect_uri: 'http://mysite.com',
link: 'http://mysite.com',
picture: 'http://mysite/images/banner-1.png',
name: 'Mysite',
caption: 'website',
description: 'website'
};

function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}

FB.ui(obj, callback);
}

</script>
</body>
</html>