Last 15 Snips show! Welcome to Snipped, a code gallery for creating, saving and sharing all kinds of code snippets.

Facebook letzter Beitrag - Get Last Post

PHP · May 02, 2016 4:24 pm

0 0 476

Zeigt den letzten Beitrag einer Facebook Seite an. 

  • Titel
  • Bild
  • Beschreibung
  • Link

<?php 
header('Content-Type: text/html; charset=utf-8');
// Token generieren
// https://developers.facebook.com/tools/explorer/
$data = file_get_contents("https://graph.facebook.com/Webgreat.de/promotable_posts?access_token=T#O#K#E#N");
$result = json_decode($data);
$latest_post = $result->data[0];
$latest_post_title = $latest_post->name;
$latest_post_image = $latest_post->picture;
$latest_post_text = $latest_post->description;
$latest_post_link = $latest_post->actions[0]->link;

echo $latest_post_title;
echo $latest_post_image;
echo $latest_post_text;
echo $latest_post_link;
?>


<h1><?php echo $latest_post_title; ?></h1>
<img src="<?php echo $latest_post_image; ?>">
<p><?php echo $latest_post_text; ?></p>
<a href="<?php echo $latest_post_link; ?>">Link</a>

Discuss this Snip
    No Discussion Comments found.

    You must be Signed In to discuss this Snip
Chris

Chris

Joined on
April 28, 2016

  • 22 Snips
    Contributed
  • 19 Likes
    Given
  • 8 Comments Posted
Snip Tags
Get Social And Share

Manage and share all of your code snippets in one easy place.