I’ve been assign to work in facebook api. But I have this one problem, it gives me this error: An error occurred. Please try again later. By the way I’m using Codeigniter framework.
For now I have this:
function sns()
{
$user = $this->facebook->getUser();
if($user) {
try {
$data['user_profile'] = $this->facebook->api('/me');
echo '<pre>'.htmlspecialchars(print_r($data['user_profile'], true)).'</pre>';
}catch (FacebookApiException $e) {
error_log($e);
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
$data['user'] = NULL;
}
}
if($user) {
$data['logoutUrl'] = $this->facebook->getLogoutUrl();
} else {
$params = array(
'scope' => 'read_stream, friends_likes',
'redirect_uri' => site_url('/home/sns')
);
$data['loginUrl'] = $this->facebook->getLoginUrl($params);
}
$this->load->vars($data);
$this->load->view('home/sns');
}
in my url:
I think my problem is the redirect_uri parameter part. What I want is after logged-in via fb it will redirect back to my sns function/method. Am I doing it right? Please help
It may be currently down.
Your site URL should be a URI, like http://somedomain.com/sns/ not a path in the system. As this is a HTTP redirect from Facebook in your users’s browser