Vineet Sharma
Vineet Sharma

Reputation: 817

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.

Upvotes: 0

Views: 1953

Answers (1)

jBit
jBit

Reputation: 2981

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

Upvotes: 2

Related Questions