I have made a facebook application in php mysql, now i want to pass updates from the application to the users wall, its not a like button but an activity that i want to share on user wall. much like:
xxx just had pizza for lunch, via logUrLunch App
i hv managed to connect to facebook and got user id from facebook as follows:
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
try {
// Get the user profile data you have permission to view
$user_profile = $facebook->api('/me');
$uid = $facebook->getUser();
session_start();
$_SESSION['userID'] = $uid;
//print_r($user_profile);
//echo "</pre>";
} catch (FacebookApiException $e) {
$user = null;
}
} else {
die('<script>top.location.href="'.$facebook->getLoginUrl().'";</script>');
}
below code surely works: even if you dont have permission it will try to get them