Facebook

277 views
244 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
277
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Facebook

  1. 1. //set facebook permission $permission = array(email, publish_stream, offline_access, create_event, user_about_me, user_birthday, user_events, user_groups, user_likes, user_relationships, user_relationship_details, user_videos, user_website, publish_stream, manage_friendlists, user_actions.video, read_stream, publish_actions);//facebook app config $config = array(fb_key => 325679064192776, fb_secret => 5bdd22dde7ab5c51cb9f184cb47fd5bc, fb_redirect => http://erwin.com/facebook.php);
  2. 2. // instantiate the object facebook authentication$auth = eden(facebook)->auth($config[fb_key], $config[fb_secret], $config[fb_redirect]);$fbLogin = $auth->getLoginUrl($permission);if(isset($_GET[code])) { $access = $auth->getAccess($_GET[code]); $_SESSION[token] = $access[access_token]; header(Location: /facebook.php);}
  3. 3. // instantiate the object graph$graph = eden(facebook)->graph($_SESSION[token]);$user = $graph->getUser();$permissions = $graph->getPermissions();$picture = $graph->getPictureUrl();$note = $graph->createNote(me, note, eden);$logOut = $graph->getLogoutUrl($config[fb_redirect]);
  4. 4. // instantiate link object$link = eden(facebook)->link($_SESSION*token+, ‘http://www.youtube.com);//trigger create to post$link->create();
  5. 5. // instantiate event object$event = eden(facebook)->event($_SESSION[token], Event Title, September07, 2012 6:46pm, September 10, 2012 7:46pm);//trigger create to create event$event->create();
  6. 6. // instantiate post object$post = eden(facebook)->post($_SESSION[token], POSTING);$post->create();$post->setTitle() ->setPicture() // ->setVideo() ->setDescription() ->setLink() ->setIcon() ->create();
  7. 7. // instantiate fql object$fql = eden(facebook)->fql($_SESSION[token]);$friends = $fql->query(SELECT uid1, uid2 FROM friend WHERE uid1=".$user[id].");echo count($friends).<br />;shuffle($friends);foreach($friends as $i => $friend ) { $info = $fql->search() ->setTable(user) ->filterByUid($friend[uid2]) ->getRows(); echo <img src=".$info[0][pic_big]."/>; echo $info[0][first_name];}
  8. 8. $stream = $fql->query(SELECT filter_key FROM stream_filter WHEREuid=.$user[id]);$streams = $fql->search() ->setTable(stream_filter) ->filterByUid($user[id]) ->getRows();$likes = $fql->search() ->setTable(like) ->filterByUserId($user[id]) ->getRows();$userPost = $fql->search() ->setTable(status) ->filterByUid($friends[0][uid2]) ->getRows();

×