문제

I need to display all Facebook events inside a group. I know the group id and the creator id but I am unable to display them.

I always get NULL values in the return, as if they don't exist. How can I get this code to work?

  • The group is public
  • I want to display the events on a external page even if the user is not logged in so every visitor sees the events of this group.

Code:

facebook = new Facebook(
    array('appId' => $this -> params -> get('appid'), 
          'secret' => $this -> params -> get('secret'), 
          'cookie' => true, // enable optional cookie support
         )
    );

// Get the current access token
$access_token = $facebook->getAccessToken();

$fql = "SELECT name, pic, eid, start_time, end_time, location, description, update_time from event WHERE creator=XXXXXXXXXXX and eid IN ( SELECT eid FROM event_member WHERE uid = " . $this -> params -> get('idfbpage') . ")";    

$fqlResult = $facebook -> api($param);

Returns null lines, even all the events created by that creator would be OK assuming that they create events ONLY for this group.

도움이 되었습니까?

해결책

Did you try with the Graph API?

/[group-id]/events

I just tried it, and it delivers me all the events from a group, i also get older ones. You can also get the owner of the event easily:

/[group-id]/events?fields=owner

You can do this with just an app access token, which is created like this:

$access_token = FBAPPID . '|' . FBSECRET;

If there is a solution with the Graph API, you should always go for it. FQL is a pain.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top