开发者

Facebook Application Post to Wall

开发者 https://www.devze.com 2023-03-23 18:24 出处:网络
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 d

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) {  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消