unset($user[$stat]);
            }
        }
    }
    unset($user);
    foreach ($users as $user) {
        $table .= '<tr>';
        foreach ($user as $stat => $value) {
            $table .= $stat === 'id' ? "<td><img src='https://graph.facebook.com/{$value}/picture' /></td>" : "<td>{$value}</td>";
        }
        $table .= '</tr>';
    }
    $table .= '</table>';
    echo "<div class='span10'><h3>{$column}</h3>{$table}</div>";
}
$fb = new FbStats($config);
$feedParams = array('sourceId' => $sourceId, 'limit' => 500, 'since' => 'last+Year');
$stats = array('totalStatus', 'totalLinks', 'totalStatusChars', 'didLike', 'didComment', 'didCommentChars', 'gotLikes', 'gotComments', 'gotLikesOnComments', 'gotTags');
?>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Facebook Groups Analytics</title>
        <link href="../css/bootstrap.min.css" rel="stylesheet" />
        <link href="../css/custom.css" rel="stylesheet" />
    </head>

    <body>

        <div class="topbar">
            <div class="fill">
Пример #2
0
<?php

require_once '../../FbStats.php';
include_once '../config.php';
include_once 'helper.php';
if (!session_id()) {
    session_start();
}
// Create Facebook Instance
$fb = new FbStats($config);
if (isset($_POST['publish'])) {
    try {
        $wall_post = $fb->wallPost($_POST['group'], $_POST['message']);
        if ($wall_post) {
            echo '<div class="success">Published</div>';
        } else {
            echo '<div class="alert-message error">Error in publishing result. Please try again.</div>';
        }
    } catch (Exception $e) {
        echo '<div class="alert-message error">' . $e->getMessage() . '</div>';
    }
} else {
    // Get submitted data
    $since = !empty($_POST['from']) ? time_ago(time() - strtotime(urldecode($_POST['from']))) : 'yesterday';
    $until = !empty($_POST['to']) ? time_ago(time() - strtotime(urldecode($_POST['to']))) : 'now';
    $stat = $_POST['stat'];
    $usersCount = !empty($_POST['usersCount']) ? $_POST['usersCount'] : 10;
    $selfComments = isset($_POST['selfComments']) ? $_POST['selfComments'] : 0;
    $ignoreLinks = isset($_POST['ignoreLinks']) ? $_POST['ignoreLinks'] : 0;
    $ignorePhotos = isset($_POST['ignorePhotos']) ? $_POST['ignorePhotos'] : 0;
    $minLines = isset($_POST['minLines']) && !empty($_POST['minLines']) ? $_POST['minLines'] : 0;
Пример #3
0
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once '../../FbStats.php';
include_once '../config.php';
include_once 'helper.php';
if (!session_id()) {
    session_start();
}
$fb = new FbStats($config);
$feedParams = array('sourceId' => $sourceId, 'limit' => 200, 'since' => 'last+Year');
//get Groups
try {
    $groups = $fb->getInfo('me/groups');
} catch (Exception $e) {
    echo '<div class="alert-message error">' . $e->getMessage() . '</div>';
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Facebook Groups Analytics</title>
        <link href="../css/bootstrap.min.css" rel="stylesheet" />
        <link href="../css/custom.css" rel="stylesheet" />
		
		<script src="jquery-1.7.1.min.js"></script>
		<script src="jquery.ui.core.js"></script>
		<script src="jquery.ui.widget.js"></script>
		<script src="jquery.ui.datepicker.js"></script>
 /**
  * This static function gets Facebook class instance.
  *
  * @param array $params parameters containing facebook application details.
  *
  * @return object
  */
 public function getFbInstance($params)
 {
     self::$instance = new Facebook(array('appId' => $params['appId'], 'secret' => $params['secret'], 'cookie' => true));
     return self::$instance;
 }
Пример #5
0
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once 'lib/FbLogin.php';
include_once 'lib/config.php';
try {
    $fb = new FbStats($config);
    $user = $fb->getInfo('me');
    $_SESSION['user'] = $user;
    header("Location: question.php");
} catch (Exception $e) {
    unset($_SESSION['user']);
    echo '<div class="alert-message error">' . $e->getMessage() . '</div>';
}
<?php

require_once '../../FbStats.php';
include_once '../config.php';
if (!session_id()) {
    session_start();
}
$response = array();
$sourceId = $_POST['sourceId'];
$message = $_POST['wallPostMessage'];
try {
    $fb = new FbStats($config);
    $sent = $fb->sendInfo($sourceId, $message);
} catch (Exception $e) {
    $response['error'] = $e->getMessage();
}
if (!isset($response['error'])) {
    $response['success'] = "The message was successfully posted";
}
echo json_encode($response);