I need to write application that will be sending links to facebook fanpage wall.
I use a PHP SDK v3. There is a example how to post stuff:
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'XXXX',
'secret' => 'YYYYYYYYYY',
'cookie' => true,
));
$fbsession = $facebook->getSession();
if ($fbsession) {
$attachment = array(
'message' => 'this is my message',
'name' => 'This is my demo Facebook application!',
'caption' => "Caption of the Post",
'link' => 'http://www.lycos.com',
'description' => 'Test de post depuis application PHP',
'picture' => 'http://www.lalibre.be/img/logoLaLibre.gif',
'actions' => array(array('name' => 'Get Search',
'link' => 'http://www.google.com'))
);
$result = $facebook->api('/USER_WALL/feed/','post',$attachment);
}
and it works fine. The problem is I want to post just a normal facebook-link (with link icon, without application name and with Share button)
something like this:
$result = $facebook->api('/USER_WALL/feed/','link',$attachment);
gives me an error (Fatal error: Uncaught Exception: Unsupported method, link thrown in /home/.../src/base_facebook.php on line 959)
any ideas how to do this?
I found two links to FB Documentation:
- http://developers.facebook.com/docs/reference/rest/links.post/
- http://developers.facebook.com/docs/reference/api/link/
but I still don’t know use this in PHP-SDK v3
solved: