Skip to main content

How do you post to the wall on a facebook page (not profile)


I have a blog site written in php and it posts new blog posts to twitter and a blog ping automatically under the hood using simple http post requests passed using php curl.



I have a facebook page for the blog site and want the updates to be posted to the wall on the page, is there a simple way to do this?



What I really want is a url and set of params to parcel up as an http post request.



Note that this is to post to the wall on a new style page not a profile.



Thanks in advance.


Source: Tips4allCCNA FINAL EXAM

Comments

  1. <?php
    $attachment = array(
    'message' => 'this is my message',
    'name' => 'This is my demo Facebook application!',
    'caption' => "Caption of the Post",
    'link' => 'http://mylink.com',
    'description' => 'this is a description',
    'picture' => 'http://mysite.com/pic.gif',
    'actions' => array(
    array(
    'name' => 'Get Search',
    'link' => 'http://www.google.com'
    )
    )
    );


    $result = $facebook->api('/me/feed/', 'post', $attachment);


    the above code will Post the message on to your wall... and if you want to post onto your friends or others wall then replace me with the Facebook User Id of that user..for further information look out the API Documentation.

    ReplyDelete
  2. Harish has the answer here - except you need to request manage_pages permission when authenticating and then using the page-id instead of me when posting....

    $result = $facebook->api('page-id/feed/','post',$attachment);

    ReplyDelete
  3. You can not post to Facebook walls automatically without creating an application and using the templated feed publisher as Frank pointed out.

    The only thing you can do is use the 'share' widgets that they provide, which require user interaction.

    ReplyDelete
  4. This work to me:

    try {
    $statusUpdate = $facebook->api('/me/feed', 'post',
    array('name'=>'My APP on Facebook','message'=> 'I am here working',
    'privacy'=> array('value'=>'CUSTOM','friends'=>'SELF'),
    'description'=>'testing my description',
    'picture'=>'https://fbcdn-photos-a.akamaihd.net/mypicture.gif',
    'caption'=>'apps.facebook.com/myapp','link'=>'http://apps.facebook.com/myapp'));
    } catch (FacebookApiException $e) {
    d($e);
    }

    ReplyDelete
  5. If you're blog outputs an rss feed you can use Facebook's "RSS Graffiti" application to post that feed to your wall in FB. There are other RSS facebook apps as well just search facebook for rss apps...

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.