mardi 24 février 2015

Get user's Facebook events with php

i want to get all user's Facebook attending events by PHP, i found many examples by searching in google, but all of them talks about "how to get all page's Facebook attending events". as it:



<?php
02
// Get these from http://ift.tt/qwEhdy
03
$api_key = '2c73ae85291aaaaaaaaaaaaaaaaaaaaa';
04
$secret = '3c041a7cbd7aaaaaaaaaaaaaaaaaaaaa';
05

06
include_once './facebook-platform/php/facebook.php';
07

08
$facebook = new Facebook($api_key, $secret);
09
$user = $facebook->require_login();
10

11
?>
12
<h1>Yummie Tester</h1>
13
Hello <fb:name uid='<?php echo $user; ?>' useyou='false' possessive='true' />! <br>
14
Your id : <?php echo $user; ?>.<br>
15

16
<h2>Event<h2>
17
<?
18
$events = $facebook->api_client->events_get(null, null, null, null, null);
19

20
//echo "<h3>Return array from Facebook</h3>";
21
//print_r($events);
22
?>
23
<table>
24
<?
25
foreach($events as $event){
26
?>
27
<tr>
28
<td colspan="2"><?=date("l dS F Y",$event['start_time'])?></td>
29
</tr>
30
<tr>
31
<td><img src="<?=$event['pic_small']?>"></td>
32
<td valign="top">
33
<?=$event['name']?>
34
<br>
35
<?=$event['tagline']?>
36
<br><br>
37
Type: <?=$event['event_type']?> - <?=$event['event_subtype']?><br>
38
Where: <?=$event['location']?><br>
39
When: <?=date("dS F Y h:i",$event['start_time'])?> - <?=date("dS F Y h:i",$event['end_time'])?><br>
40
</td>
41
</tr>
42
<tr>
43
<td> </td>
44
</tr>
45
<?
46
}
47
?>
48
</table>


found here http://ift.tt/yBLht5


I've got a profile, where i put "Attend" on some events, and i need to display all my attending events on a webpage, is it possible? and how can i do? Thank you so much.


Aucun commentaire:

Enregistrer un commentaire