简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM