Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- Source: http://ranacse05.wordpress.com/2011/02/04/show-facebook-group-wall-on-web-site/
- Modified on 26 May 2013 by Ibnu Asad (http://www.ibnuasad.org)
- + Fixed HTML Styles
- + Fixed CSS width values
- + Added access token support
- Instructions:
- 1) Get an access token from https://developers.facebook.com/tools/explorer
- 1a) Additional Permissions for CLOSED GROUPS, please select "user_groups" & "friends_groups"
- 2) Find your Facebook Group ID via http://www.wallflux.com/facebook_id/
- **/
- $limit = 5; // The number of posts fetched
- $access_token = 'INSERT ACCESS TOKEN HERE';
- $group_id = 'INSERT GROUP ID HERE';
- $url1 = 'https://graph.facebook.com/'.$group_id.'?access_token='.$access_token;
- $des = json_decode(file_get_contents($url1));
- /**echo '<pre>';
- print_r($des);
- echo '</pre>';**/
- $url2 = "https://graph.facebook.com/{$group_id}/feed?access_token={$access_token}";
- $data = json_decode(file_get_contents($url2));
- ?>
- <style type="text/css">
- .wrapperfb {
- width:100%;
- border:1px solid #ccc;
- font-family: "lucida grande",tahoma,verdana,arial,sans-serif;
- float:left;
- }
- .topfb {
- margin:5px;
- border-bottom:2px solid #e1e1e1;
- float: left;
- width:90%;
- }
- .singlefb {
- margin:3px;
- border-bottom:1px dashed #e1e1e1;
- float:left;
- }
- .imgfb {
- float:left;
- width:60px;
- text-align:center;
- margin:5px 5px 5px 0px;
- border-right:1px dashed #e1e1e1;
- }
- .textfb {
- width:75%;
- float:left;
- font-size:12px;
- }
- .afb {
- text-decoration: none;
- color: #3b5998;
- }
- </style>
- <div class="wrapperfb">
- <div class="topfb">
- <a class="afb" href='http://www.facebook.com/home.php?sk=group_<?=$group_id?>&ap=1'>
- <?=$des->name?></a>
- <div style="width:100%; margin: 5px">
- <?=$des->description?>
- </div>
- </div>
- <?
- $counter = 0;
- foreach($data->data as $d) {
- if($counter==$limit)
- break;
- ?>
- <div class="singlefb">
- <div class="imgfb">
- <a class="afb" href="http://facebook.com/profile.php?id=<?=$d->from->id?>">
- <img border="0" alt="<?=$d->from->name?>" src="https://graph.facebook.com/<?=$d->from->id?>/picture"/>
- </a>
- </div>
- <div class="textfb">
- <span style="font-weight:bold"><a class="afb" 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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement