Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use facebook php sdk in codeigniter?
    primarykey
    data
    text
    <p>I am trying to fetch user data from facebook using facebook PHP SDK. (I am developing the site in codeigniter). But it's showing me a error when I click the login url link. It's showing</p> <blockquote> <p>ERROR</p> <p>An error occurred. Please try again later.</p> </blockquote> <p>Here is the code of C:\wamp\www\project\application\models\test\facebook_model.php</p> <pre><code>&lt;?php class Facebook_model extends CI_Model { public function __construct() { parent::__construct(); $config = array( 'appId' =&gt; 'API Key', 'secret' =&gt; 'Secret Key', 'fileUpload' =&gt; true, ); $this-&gt;load-&gt;library('facebook/Facebook', $config); $user = $this-&gt;facebook-&gt;getUser(); $profile = null; if($user) { try { // Proceed knowing you have a logged in user who's authenticated. $profile = $this-&gt;facebook-&gt;api('/me?fields=id,name,link,email'); } catch (FacebookApiException $e) { error_log($e); $user = null; } } $fb_data = array( 'me' =&gt; $profile, 'uid' =&gt; $user, 'loginUrl' =&gt; $this-&gt;facebook-&gt;getLoginUrl( array( 'scope' =&gt; 'email,user_birthday,publish_stream', 'redirect_uri' =&gt; 'http://herle.in/flutter/index.php/test/userRegistration2' ) ), 'logoutUrl' =&gt; $this-&gt;facebook-&gt;getLogoutUrl(), ); $this-&gt;session-&gt;set_userdata('fb_data', $fb_data); } } </code></pre> <p>Here is the code of C:\wamp\www\project\application\contorllers\userRegistration2.php</p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class UserRegistration2 extends CI_Controller { function __construct() { parent::__construct(); $this-&gt;load-&gt;model('test/Facebook_model'); } function index() { $fb_data = $this-&gt;session-&gt;userdata('fb_data'); // This array contains all the user FB information if((!$fb_data['uid']) or (!$fb_data['me'])) { echo "&lt;a href='" .$fb_data['loginUrl']. "'&gt;Login&lt;/a&gt;"; } else { $data = array( 'fb_data' =&gt; $fb_data, ); print_r($data); } } } </code></pre> <p>and in libraries/facebook I have the 2 facebook PHP SDK files. i.e. Facebook.php and base_facebook.php</p> <p>This is the link <a href="http://herle.in/flutter/index.php/test/userRegistration2.html" rel="nofollow">http://herle.in/flutter/index.php/test/userRegistration2.html</a> and after clicking Login link it's showing the error.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload