Пример #1
0
<?php

include 'config.php';
?>
<html>
<body>
<?php 
function getUserImagem($id)
{
    $graph_url = "https://graph.facebook.com/" . $id . "/picture?type=large";
    //echo $graph_url.'<br>';
    $user = json_decode(file_get_contents($graph_url));
    return $user;
    //if($user != null && isset($user->picture))
    //  return $user;
    //return null;
}
//100007164392247
$user_imagem = getUserImagem($_SESSION['IDSOCIAL']);
var_dump($user_imagem);
echo '<br>';
?>

<br>
<img src="https://graph.facebook.com/100007164392247/picture?type=large" />

Пример #2
0
    header('Location: http://diretoriomogi.com.br/view/login.php');
    //change this
    exit(0);
}
$access_token_details = getAccessTokenDetails($app_id, $app_secret, $redirect_url, $code);
if ($access_token_details == null) {
    echo "Unable to get Access Token";
    exit(0);
}
if ($_SESSION['state'] == null || $_SESSION['state'] != $_REQUEST['state']) {
    header('location: http://diretoriomogi.com.br ');
}
$_SESSION['access_token'] = $access_token_details['access_token'];
//save token is session
$user = getUserDetails($access_token_details['access_token']);
$user_imagem = getUserImagem($user->id, $_SESSION['access_token']);
$Login = new Login('', '', $imagem_anonimo);
$Login->logar_face($user->id, '', '', $user->name, $user_imagem, $user->email);
?>
    <script>
          window.location.href = '<?php 
echo $_SESSION['URL_ATUAL'];
?>
';
    </script>   
<?php 
/*var_dump $user {
     ["id"]=> string(15) "100000078362129" 
      ["email"]=> string(21) "*****@*****.**" 
      ["first_name"]=> string(6) "Marcos" 
      ["gender"]=> string(4) "male"