Ciao a tutti, volevo sapere se qualcuno conosce un modo funzionante per ricavare lo status di Facebook... diciamo i post "scritti manualmente" non i soliti links del cavolo. Ho letto su internet che si dovrebbe creare un'applicazione, ho buttato giù questo, ma non funziona... eppure risulto collegato!
Array ( [id] => https://graph.facebook.com/me/feed [shares] => 2 )
Codice PHP:
<?
require_once "facebook/facebook.php";

$facebook = new Facebook(array(
'appId' => 'xxx',
'secret' => 'xxx',
'cookie' => true,
));

function
get_facebook_cookie($app_id, $application_secret) {
$args = array();
parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
ksort($args);
$payload = '';
foreach (
$args as $key => $value) {
if (
$key != 'sig') {
$payload .= $key . '=' . $value;
}
}
if (
md5($payload . $application_secret) != $args['sig']) {
return
null;
}
return
$args;
}

$cookie = get_facebook_cookie($facebook->getAppId(),$facebook->getApiSecret());
print_r($cookie);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

<head>
<title>Test Status Facebook</title>
</head>

<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({appId: '<? echo $facebook->getAppId(); ?>', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('auth.sessionChange', function(response) {
if (response.session) {
// A user has logged in, and a new cookie has been saved
} else {
// The user has logged out, and the cookie has been cleared
}
});
</script>
<?


$me
= $facebook->api("https://graph.facebook.com/me/feed");
print_r($me);

$login = <<<login
<fb:login-button perms="publish_stream,read_stream,offline_access,user_status">Richista dei permessi</fb:login-button>
login;

echo
$login;
Grazie mille!! Ciao, Davide! =)