I've read many other topics about this subject but I didn't find something helpful.
What I want to do
When I add an article on my website, I'd like to post an update on Twitter and Facebook. It's working for Twitter, but I have an issue with Facebook.
I downloaded the facebook.php which uses OAuth.
My issue
When I post a simple text, it works fine, it's displayed as posted by the page as wanted. But when I want to post a text with a thumbnail, a link, a caption and a description, it's posted as if my personal account was posting this update onto my page's wall.
Here is my code for the simple text (I requested the acces_token above):
$post = array('access_token' => $token, 'message' => 'My message');
try{
$res = $facebook->api('/mypage/feed','POST',$post);
print_r($res);
} catch (Exception $e){
echo $e->getMessage();
}
Here is the wrong code:
$post = array('access_token' => $token,
'message' => 'My message',
'picture' => 'http://www.website.com/picture.jpg',
'link' => 'http://www.website.com',
'caption' => 'test caption',
'description' => 'test description',
'from' => array('name' =>'Page name', 'id' => 'page id'),
);
try{
$res = $facebook->api('/mypage/feed','POST',$post);
print_r($res);
} catch (Exception $e){
echo $e->getMessage();
}
The Facebook API is not well documented but I've searched everywhere not to ask you this question .. But I don't find any solution.
Thanks a lot for helping me.
Benjamin