$app_id = 'APP_ID';
$app_secret = "APP_SECRET";
$my_url = "http://YOURDOMAIN/";
$code = $_REQUEST["code"];
if(empty($code)) {
$dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url)."&scope=email,read_stream,publish_stream";
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
$token_url = "https://graph.facebook.com/oauth/access_token?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret="
. $app_secret . "&code=" . $code;
$access_token = file_get_contents($token_url);
$graph_url = "https://graph.facebook.com/me?" . $access_token;
$user = json_decode(file_get_contents($graph_url));
//print the current user details
print_r($user);
$query = "https://api.facebook.com/method/fql.query?query=";
$query .= urlencode("SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0");
//$query .= "&access_token=".$access_token."&format=json";
$out = file_get_contents($query);
$response = json_decode($out);
//print the current users news feeed
print_r($response);
$app_secret = "APP_SECRET";
$my_url = "http://YOURDOMAIN/";
$code = $_REQUEST["code"];
if(empty($code)) {
$dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url)."&scope=email,read_stream,publish_stream";
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
$token_url = "https://graph.facebook.com/oauth/access_token?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret="
. $app_secret . "&code=" . $code;
$access_token = file_get_contents($token_url);
$graph_url = "https://graph.facebook.com/me?" . $access_token;
$user = json_decode(file_get_contents($graph_url));
//print the current user details
print_r($user);
$query = "https://api.facebook.com/method/fql.query?query=";
$query .= urlencode("SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0");
//$query .= "&access_token=".$access_token."&format=json";
$out = file_get_contents($query);
$response = json_decode($out);
//print the current users news feeed
print_r($response);