I am trying to like a Facebook post posted from an account. I have the oauth token of the account but i cant figure out how to like a post from my php code. I have a facebook app and also have the app id and app secret for my facebook app. I want to do this using the PHP SDK Version 5.0.0.
Can anyone please help with this or direct me to the some documentation apart from the one here - https://developers.facebook.com/docs/reference/php/5.0.0
Thanks
I believe creating Facebook service is not an issue. Once created, you may set a default access token for easier access. You may then take the id of the post you want to like and do this -
$response = $fb->post('/'.$post_id.'/likes');
EDIT after Tushar's comment
$response = $fb->post('/'.$post_id.'/likes', array());
where $fb is a Facebook service with a default access token. Hope this helps.
Surprisingly enough the approach that i commented on Navin's answer worked just fine now.When i had tried it previously i had gotten a 'Url not recognised' error.
My code is as follows-
$test=array(); $like=$fb->post('/'.$post_id.'/likes',$test,$token);
In the $like variable i get an object of FacebookResponse with a status of success or failure.