Reputation: 181
i have an app that process input to jpeg and then post the link of the generated image to the user's timeline. now i want to get the number of likes of each post and echo it in a with another like button(linked with the same post). how can i do that? i used 'PHP SDK' when i post the image link(in another .php file). as much as possible i want to use the POST_ID
or OJBECT_ID
to access the facebook post. please give some some suggestions on what to use and how can i start. this is my first time to work with facebook apps.
all i have for now is this on the processor.php. i want the out put to be on the gallery.php. thanks in advance for any help.
processor.php
if($user_id) {
try {
$ret_obj = $facebook->api('/me/feed', 'POST',
array(
'link' => $post_link,
'message' => 'Posting with the PHP SDK!'
));
echo '<pre>Post ID: ' . $ret_obj['id'] . '</pre>';
echo '<br /><a href="' . $facebook->getLogoutUrl() . '">logout</a>';
} catch(FacebookApiException $e) {
$login_url = $facebook->getLoginUrl( array(
'scope' => 'publish_stream, read_stream'
));
echo 'Please <a href="' . $login_url . '">login.</a>';
error_log($e->getType());
error_log($e->getMessage());
}
} else {
$login_url = $facebook->getLoginUrl( array( 'scope' => 'publish_stream, read_stream' ) );
echo 'Please <a href="' . $login_url . '">login.</a>';
}
`
Upvotes: 0
Views: 566
Reputation: 575
You get FB likes with
$likes = $facebook->api("/".$POSTID."/likes");
This returns an array...
Upvotes: 1