PHP Classes

File: demos/get_profile.php

Recommend this page to a friend!
  Classes of Edvaldo Szymonek   PHP Facebook Post to Wall, Pages or Groups   demos/get_profile.php   Download  
File: demos/get_profile.php
Role: Example script
Content type: text/plain
Description: How to get user's profile
Class: PHP Facebook Post to Wall, Pages or Groups
Send posts to Facebook user profile, pages, groups
Author: By
Last change: Update of demos/get_profile.php
Date: 8 months ago
Size: 621 bytes
 

Contents

Class file image Download
<?php
/**
 * Created by Edvaldo Szymonek
 * User: edvaldo
 * Date: 13/04/2015
 * Time: 09:46
 * Website: http://edvaldotsi.com
 */

require_once "../vendor/autoload.php";

use
FacebookApp\FacebookApp;

session_start();
$token = isset($_SESSION["token"]) ? $_SESSION["token"] : null;

$app = new FacebookApp(require "../config/app.config.php");
if (!
$app->checkAccess($token)) {
    exit(
"<a href=\"{$app->getLoginUrl()}\">Fazer login com Facebook</a>");
}

$profile = $app->getProfile();
echo
"ID: " . $profile->getId() . "<br>";
echo
"Name: " . $profile->getName() . "<br>";
echo
"Link: " . $profile->getLink() . "<br>";