php - problems creating session with facebook api -


i have updated facebook api , i'm trying initiate session this,

facebooksession::setdefaultapplication( 'foo foo','foo foo' ); 

i error on line,

fatal error: class 'facebook\src\facebook\facebooksession'not found in /foo/foo/foo/header.php on line 41 

my file path correct...

any ideas?

here full code,

<?php  error_reporting(e_all); ini_set('display_errors', 1);   // include required files form facebook sdk  // added in v4.0.5 require_once( 'facebook/src/facebook/facebookhttpable.php' ); require_once( 'facebook/src/facebook/facebookcurl.php' ); require_once( 'facebook/src/facebook/facebookcurlhttpclient.php' ); require_once( 'facebook/src/facebook/facebooksession.php' ); require_once( 'facebook/src/facebook/facebookredirectloginhelper.php' ); require_once( 'facebook/src/facebook/facebookrequest.php' ); require_once( 'facebook/src/facebook/facebookresponse.php' ); require_once( 'facebook/src/facebook/facebooksdkexception.php' ); require_once( 'facebook/src/facebook/facebookrequestexception.php' ); require_once( 'facebook/src/facebook/facebookotherexception.php' ); require_once( 'facebook/src/facebook/facebookauthorizationexception.php' ); require_once( 'facebook/src/facebook/graphobject.php' ); require_once( 'facebook/src/facebook/graphsessioninfo.php' );  use facebook\src\facebook\facebookhttpable; use facebook\src\facebook\facebookcurl; use facebook\src\facebook\facebookcurlhttpclient; use facebook\src\facebook\facebooksession; use facebook\src\facebook\facebookredirectloginhelper; use facebook\src\facebook\facebookrequest; use facebook\src\facebook\facebookresponse; use facebook\src\facebook\facebooksdkexception; use facebook\src\facebook\facebookrequestexception; use facebook\src\facebook\facebookotherexception; use facebook\src\facebook\facebookauthorizationexception; use facebook\src\facebook\graphobject; use facebook\src\facebook\graphsessioninfo;  // start session session_start();  // init app app id , secret facebooksession::setdefaultapplication( 'foo foo','foo foo' );   // login helper redirect_uri $helper = new facebookredirectloginhelper( 'http://www.wuno.com/sandbox/' );  // see if existing session exists if ( isset( $_session ) && isset( $_session['fb_token'] ) ) {   // create new session saved access_token   $session = new facebooksession( $_session['fb_token'] );    // validate access_token make sure it's still valid   try {     if ( !$session->validate() ) {       $session = null;     }   } catch ( exception $e ) {     // catch exceptions     $session = null;   }  } else {   // no session exists    try {     $session = $helper->getsessionfromredirect();   } catch( facebookrequestexception $ex ) {     // when facebook returns error     // handle better in production code     print_r( $ex );   } catch( exception $ex ) {     // when validation fails or other local issues     // handle better in production code     print_r( $ex );   }  }  // see if have session if ( isset( $session ) ) {    // save session   $_session['fb_token'] = $session->gettoken();   // create session using saved token or new 1 generated @ login   $session = new facebooksession( $session->gettoken() );    // graph api request user data   $request = new facebookrequest( $session, 'get', '/me' );   $response = $request->execute();   // response   $graphobject = $response->getgraphobject()->asarray();    // print profile data   echo '<pre>' . print_r( $graphobject, 1 ) . '</pre>';    // print logout url using session , redirect_uri (logout.php page should destroy session)   echo '<a href="' . $helper->getlogouturl( $session, 'http://www.wuno.com/sandbox/actions/fblogout.php' ) . '">logout</a>';  } else {   // show login url   echo '<a href="' . $helper->getloginurl( array( 'email', 'user_friends' ) ) . '">login</a>'; }  echo 'sup dude'; ?> 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -