facebook - Calling multiple FB Graph API requests in codeigniter -
i'm working facebook login functionality works smoothly, tried google couldn't find looking for.
i need user profile pictures, interests, likes, books, movies, music. code below controller works fine.
class welcome extends ci_controller {
public function __construct() { parent::__construct();
} public function index() {
$fb_config = array( 'appid' => '550765875685678567', 'secret' => 'e03771716c87658765843535ac38' ); $this->load->library('facebook', $fb_config); $user = $this->facebook->getuser(); if ($user) { seek { $data['user_profile'] = $this->facebook->api('/me'); } grab (facebookapiexception $e) { $user = null; } } if ($user) { $data['logout_url'] = $this->facebook ->getlogouturl(); } else { $data['login_url'] = $this->facebook ->getloginurl($params = array('scope' => "email,user_birthday, user_likes, >user_interests, user_location, read_friendlists, user_checkins, user_religion_politics, user_photos, user_likes, user_hometown, user_about_me")); }
$this->load->view('welcome',$data); } }
now if wanted run
$albums = $facebook->api('/me/albums'); in same function, how accomplish this? or how can run multiple api calls here , include in $data['user_profile']?
thanks all
you can run many api calls in sequential order , have them go info array. example:
$data['user_profile'] = $this->facebook->api('/me'); $data['user_albums'] = $this->facebook->api('/me/albums'); multiple calls won't cause problems.
facebook api codeigniter
No comments:
Post a Comment