Ejemplo n.º 1
0
/**
 * Displays the Facebook follower count.
 */
function facebook_page_count()
{
    // Get the
    $likes = get_facebook_user()->likes;
    if (!is_int($likes)) {
        return 0;
    }
    return $likes;
}
Ejemplo n.º 2
0
    if (empty($cookie)) {
        //post for logged in user
        $cookie = get_facebook_cookie();
        $cookie = $cookie['access_token'];
    }
    $attachment = '
	{
		"name": "' . utf8_encode($title) . '",
		"href": "http://www.astravires.fr",
		"caption": "' . utf8_encode($caption) . '",
		"description": "' . utf8_encode($description) . '",
		"media": [
	    {
	        "type": "image",
	        "src": "http://www.astravires.fr/images/logofb.jpg",
	        "href": "http://www.astravires.fr"
	    }]
	}';
    $action_links = array(array('text' => utf8_encode('Jouer à Astra Vires !'), 'href' => 'http://www.astravires.fr'));
    $action_links = json_encode($action_links);
    $action_links = urlencode($action_links);
    $attachment = urlencode($attachment);
    if ($cookie != "" && $title != "" && $caption != "") {
        $result = json_decode(file_get_contents("https://api.facebook.com/method/stream.publish?access_token=" . $cookie . "&attachment={$attachment}&action_links={$action_links}"));
        return $result;
    } else {
        return 0;
    }
}
$fbuser = get_facebook_user();
Ejemplo n.º 3
0
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    $result = json_decode($result);
    return $result;
}
$error = false;
$user = false;
if (!empty($_POST) && !empty($_POST['id'])) {
    $id = $_POST['id'];
    $result = $cache->get($id);
    // No cache
    if (!$result) {
        echo 'Not from cache';
        $result = get_facebook_user($id);
        $cache->set($id, $result);
    } else {
        echo 'From cache';
    }
    if (!empty($result->error)) {
        $error = true;
    } else {
        $user = $result;
    }
}
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">