medo ampir
medo ampir

Reputation: 1920

How to retrieve post ID for a post i've just made via the Facebook API

i am using the following code to publish to a Page's feed connection

    $attachment = array('message' => 'xxxxxxxxxxxxxxxxx',
            'name' => 'cccccccccccccccc',
            'caption' => 'cccccccccccccccc',
            'link' => 'http://apps.facebook.com/manydldotnet/',
            'description' => "ccccccccccccc",
            'picture' => "'cccccccccccccccc'",
            'actions' => array(array('name' => 'Download!','link' => 'http://apps.facebook.com/manydldotnet/'))
            );

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

so the question is how to get the post_id after posting it?

Upvotes: 0

Views: 5014

Answers (2)

benck
benck

Reputation: 2052

The Post's id is stored in $result['id'].

It's the return value of the call to feed; this is also the case for /links, /photos, etc.

Ref: http://developers.facebook.com/docs/reference/php/facebook-api/

Upvotes: 6

bkaid
bkaid

Reputation: 52093

Check the value in the $result variable, that should be the actual post_id value.

Upvotes: 0

Related Questions