Php Code To Add A Post On My W

I need php only code that will use my facebook application’s extended permissions and be able to add a post to my facebook page. I only want to be able to do a post with my own facebook account to my own ‘page’ not the profile but facebook page that is administered by my profile. I do not need any other users or any other pages to post or login or anything. The page has the facebook application added. The code below is only missing the persistent session part and extended permissions required to use the facebook graph api.

<?php

//Facebook php-sdk from http://github.com/facebook/php-sdk/
include ‘facebook.php’

$fbconfig[‘appid’] = “WILLPROVIDE”;
$fbconfig[‘api’] = “WILLPROVIDE”;
$fbconfig[‘secret’] = “WILLPROVIDE”;

$facebook = new Facebook(array(
‘appId’ => $fbconfig[‘appid’],
‘secret’ => $fbconfig[‘secret’],
‘cookie’ => true,
));

$loginUrl = $facebook->getLoginUrl();

//need a persistent session here
$session = $facebook->getSession();

$fbme = null;

// Session based graph API call.

$message = “”;
$link = “”;
$name = “”;
$caption = “”;
$desc = “”;
if ($session) {
try {
$uid = $facebook->getUser();
//$fbme = $facebook->api(‘/me’);
$fbme = $facebook->api(‘/166430355162/feed’);
$statusUpdate = $facebook->api(‘/166430355162/feed’, ‘post’, array(‘message’=> “$message”, ‘link’=>”$link”, ‘name’=>”$name”, ‘caption’=>”$caption”, ‘description’=>”$desc”, ‘cb’ => ”));

} catch (FacebookApiException $e) {

echo($e);

}

}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *