Well, I don't know how should name this article.... and finally I simply stick with the title that I used in the article "Enhancing Our 1st FB App - Publishing a Post onto User's Wall".

I sometimes still get lost in Facebook's terminology. I have seen people using terms like "wall", "feed", "stream" to refer to the destination where the post will go. Though I understand all these, I just don't know the official one....

Anyway, let's get started!

 

Sample Post in User's Wall

Let's take a look at a sample post that which is posted from "Our 1st FB App (Old PHP client lib)".:

Note that the following information in the post:

 

How to Publish Post via the Graph API

We will learn how to publish a post via the PHP SDK by migrating the "Publish Post onto my Wall" tab of Our 1st FB App.

Below is an extract of the migrated code (with the original code commented):

/*
   $attachment = array('name' => 'This is my demo Facebook application!',
 'href' => 'http://apps.facebook.com/peterdemo/',
 'description' => 'It is fun!',
 'media'=> array(array(
 'type'=> 'image', 
 'src' => 'http://www.takwing.idv.hk/facebook/demoapp/demoapp.gif', 
 'href' => 'http://apps.facebook.com/peterdemo/')) 
 );

 $action_links = array(array('text' => 'Start Learning', 
   'href' => 'http://www.takwing.idv.hk/tech/fb_dev/index.php') 
   );
*/

$attachment = array('message' => 'is learning how to develop Facebook apps.',
                    'name' => 'This is my demo Facebook application!',
                    'caption' => "Caption of the Post",
                    'link' => 'http://apps.facebook.com/phpsdk_demoapp/',
                    'description' => 'It is fun!',
                    'picture' => 'http://www.takwing.idv.hk/facebook/demoapp_phpsdk/img/logo.gif',
                    'actions' => array(array('name' => 'Start Learning', 
                                      'link' => 'http://www.takwing.idv.hk/tech/fb_dev/index.php'))
                    );

//$facebook->api_client->stream_publish('is learning how to develop Facebook apps.', $attachment, $action_links);
   $result = $facebook->api('/me/feed/',
                            'post',
                            $attachment);
 

 

That's simple, right?