views:

222

answers:

1

Hi,

im using the Facebook PHP Client library and want to get the Events of a user without first logging in as a user.

Is that possible?

I got the User ID and the events.get method has a parameter UID.

<?php
//  Configure
$apiKey     = 'xxx';
$secretKey  = 'xxx';

// Include Lib
require_once('facebook.php');

// init main object
$facebook = new Facebook($apiKey,$secretKey);
$events = $facebook->api_client->events_get(123456);
?>

so this piece of code does not work. if i first require a login of a certain user, i get my results. isnt it possible to get events of a user without logging in?

+1  A: 

According to the Facebook API Docs for Events.get

http://wiki.developers.facebook.com/index.php/Events.get

This method no longer requires a session key. However if you call this method without an active user session, you can only get the events for which your application was the creator; you can see only those event attendees who authorized your application. Applications can create events for users if the users grant the application the create_event extended permission.

Basically, the user has to be logged in otherwise you can only see events in which your app created.

Jayrox
i dont get anything. im the "developer" of this application under my application settings, but i dont get my events. where do i set up the "creator" or something like that?
choise
what does var_dump($events); spit out?
Jayrox
an emtpy array!
choise
so i figured it out: 1. go to your application settings: http://www.facebook.com/developers/apps.php 2. click on "View Application Profile" 3. Here you can add an Event on your Wall as the Application NOT as the Developer of the Application. After adding you can edit it to specify it better
choise
There is an API to create events from your app:http://wiki.developers.facebook.com/index.php/Events.createHas a lot of options that you can set
Jayrox