need help below is the code of index.php of my application and i want to Post on user wall after the user authorize my application with OFFLINE_ACCESS AND publish_stram
offline_access permissionGet familiar with the PHP-SDK and use the code in the example page as your index, something like:
<?php
require '../src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'XXXXXXX',
'secret' => 'XXXXXXXX',
'cookie' => true,
));
$session = $facebook->getSession();
$loginUrl = $facebook->getLoginUrl(array(
"req_perms" => "publish_stream"
));
$me = null;
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
echo "Welcome User: " . $me['name'] . "<br />";
$post_id = $facebook->api("/$uid/feed", "post", array("message"=>"Hello World!"));
if(isset($post_id))
echo "A new post to your wall has been posted with id: $post_id";
} catch (FacebookApiException $e) {
error_log($e);
}
} else {
echo("<script> top.location.href='" . $loginUrl . "'</script>");
}
?>