Facebook Application Post to Wall
I want to post 开发者_运维问答some info along with an icon about my facebook app on the users Wall as soon as he give the permission. The app is created in iframe and I want to use Graph API. I have done this before but the facebook SDK recently changed.
Something like:
$facebook = new Facebook(array(
'appId' => $appId, // YOUR APP ID
'secret' => $apiSecret, // YOUR API SECRET
'cookie' => true
));
$user = $facebook->getUser();
if($user) {
$attachment = array(
'name' => 'NAME',
'caption' => 'CAPTION',
'link' => 'http://yourlink.com',
'description' => 'DESCRIPTION',
'picture' => 'http://yourlink.com/yourimage.jpg'
);
try { $result = $facebook->api('/me/feed/', 'post', $attachment); } catch (Exception $e) { }
}
精彩评论