在网站上显示Facebook Group Wall Feed

时间:2014-10-07 04:34:33

标签: php facebook

我几周来一直在网上搜索如何在网站上展示 Facebook群组 Wall Feed。我只发现了一段似乎有用的php代码。问题是这个代码可以在我的服务器上运行,但不能用于实时显示 Facebook Group Wall feed的服务器。如果需要,我可以提供代码。任何使用php或任何其他方法的解决方案都将受到赞赏。谢谢。

这是代码。

.events {
text-align:left;
font-size:.8em
	
}

#entries {
text-align:left	
}

.event-month {
font-size:1.0em	
}
 <?php
header ('Content-type: text/html; charset=utf-8'); 
$limit = 5;
 
$group_id = '17906888936';
$url1 = 'https://graph.facebook.com/'.$group_id;
$des = json_decode(file_get_contents($url1));
 
$url2 = "https://graph.facebook.com/{$group_id}/feed?access_token=321965427969215|0mLC-FGb6Tbk4VAoqTFYlCHgxw4";
$data = json_decode(file_get_contents($url2));
?> 
<div style="overflow:auto;height:300px">
 <div style="margin-bottom:20px">
 <a href='http://www.facebook.com/home.php?sk=group_<?=$group_id?>&ap=1'>
<?=$des->name?></a>
 <div style="width:90%; margin: 5px;">
 <?=$des->description?>
 </div>
 </div>
 <?
 $counter = 0;
  
 foreach($data->data as $d) {
 if($counter==$limit)
 break;
 ?>
 <div style="margin-bottom:20px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#EEE">
 <div>
 <a href="http://facebook.com/profile.php?id=<?=$d->from->id?>">
    <img style="float:left;padding-right:10px" border="0" alt="<?=$d->from->name?>" src="https://graph.facebook.com/<?=$d->from->id?>/picture"/>
 </a>
 </div>
 <div>
 <span style="font-weight:bold"><a href="http://facebook.com/profile.php?id=<?=$d->from->id?>">
<?=$d->from->name?></a></span><br/>
 <span style="color: #999999;">on<?=date('F j, Y H:i',strtotime($d->created_time))?></span>
 <br/>
 <?=$d->message?>
 </div>
 </div>
 <?
 $counter++;
 }
 ?>
    </div>

0 个答案:

没有答案
相关问题