Es ist leicht, wenn mans weiß. Aber wissen muss mans erstmal. Ich habe die Wallposts einer Facebook Seite ausgelesen:
require_once 'facebook.php';
$fb = new Facebook(array(
'appId' => APP_ID,
'secret' => APP_SECRET,
'cookie' => true
));
$at = $fb->getAccessToken();
$url = 'https://graph.facebook.com/PAGE_ID/feed?limit=10&access_token='.$at;
$contents = file_get_contents($url);
$FBdata = json_decode($contents);
Und festgestellt, dass nicht überall ein Link mitgegeben wird. Daher habe ich ihn selbst zusammengebaut:
foreach($FBdata->data as $k => $data){
if($data->message){
$id_arr = explode("_", $data->id); //get the post ID from PAGEID_POSTID
$msg = $data->message; // the message
$msg = explode("###", wordwrap($msg,50, "###")); //short it down to 50 characters
$link = 'https://www.facebook.com/PAGEURL/posts/'.$id_arr[1];
echo "<a href='".$link."'>".$msg[0]."...</a>";
}
}
Damit lautet der Permalink zu einem Beitrag https://www.facebook.com/PAGEURL/posts/POSTID.