PHP Classes

File: demos/tag_friends.php

Recommend this page to a friend!
  Classes of Edvaldo Szymonek   PHP Facebook Post to Wall, Pages or Groups   demos/tag_friends.php   Download  
File: demos/tag_friends.php
Role: Example script
Content type: text/plain
Description: How to tag friends in a post
Class: PHP Facebook Post to Wall, Pages or Groups
Send posts to Facebook user profile, pages, groups
Author: By
Last change: Update of demos/tag_friends.php
Date: 11 months ago
Size: 711 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;
use
FacebookApp\Profile;

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>");
}

$post = new Post("Testando aplicativo do Facebook");
$post->addTag(new Profile("friend ID"));
$post->addTag(new Profile("friend ID"));
$post->setPlace("Page location ID");

$profile = $app->getProfile();
$profile->publish($post);