Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish to wall with Facebook API

I would like users to be able to post to their wall from my site. When I click on my submit to FB link, the Facebook popup just says "An Error Occurred. Please try again later." Firebug just says that the error is "Image corrupt or truncated: ". I get this same message if try any FB method, like FB.login or FB.getLoginStatus. I know that's not a lot to go off of, but does anyone have ideas for what's going wrong, or a better way to debug this?

function load_FB(){
  FB.init({
    appId  : xxxxxxxxxxxxxxxx,
    status : true,
    cookie : true, 
    xfbml  : true  
  });
}

var publish = {method: 'feed', message: 'my message'};
function publish_wall_post()
{
  FB.ui(publish);
}
like image 539
mill Avatar asked Jul 20 '11 17:07

mill


2 Answers

Take a look at the FB.ui docs at https://developers.facebook.com/docs/reference/javascript/FB.ui/

 FB.ui(
   {
     method: 'feed',
     name: 'Facebook Dialogs',
     link: 'https://developers.facebook.com/docs/reference/dialogs/',
     picture: 'http://fbrell.com/f8.jpg',
     caption: 'Reference Documentation',
     description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
     message: 'Facebook Dialogs are easy!'
   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
 );
like image 188
Jeff Sherlock Avatar answered Oct 03 '22 00:10

Jeff Sherlock


thinkdiff has a great working example on how to publish on a wall. http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/

like image 33
gerl Avatar answered Oct 03 '22 02:10

gerl