how to implementation "graph.facebook" in php file -


i want use http://graph.facebook.com/xxx in site how php file have use system , show facebook details when enter link?

xxx = userrname

i want site show details of facebook user enter site

i tried nothing, dont want make ap this:

<?php session_start();  require_once 'autoload.php'; use facebook\facebooksession; use facebook\facebookrequest; use facebook\graphuser; use facebook\facebookrequestexception; use facebook\facebookredirectloginhelper;  $api_key = 'facebook_app_id'; $api_secret = 'facebook_app_secret'; $redirect_login_url = 'http://www.yoursite.com/somefolder/file.php';    // https://www.webniraj.com/2014/05/01/facebook-api-php-sdk-updated-to-v4-0-0/  // initialize app using key , secret facebooksession::setdefaultapplication($api_key, $api_secret);  // create helper opject needed create login url // $redirect_login_url page visitor come after login $helper = new facebookredirectloginhelper( $redirect_login_url);   // first check if existing php session if ( isset( $_session ) && isset( $_session['fb_token'] ) ) {     // create new session existing php sesson     $session = new facebooksession( $_session['fb_token'] );     try {         // validate access_token make sure it's still valid         if ( !$session->validate() ) $session = null;     } catch ( exception $e ) {         // catch exceptions , set sesson null         $session = null;         echo 'no session: '.$e->getmessage();     } }  elseif ( empty( $session ) ) {     // session empty, create new 1     try {         // visitor redirected login, let's pickup session         $session = $helper->getsessionfromredirect();     } catch( facebookrequestexception $e ) {         // facebook has returned error         echo 'facebook (session) request error: '.$e->getmessage();     } catch( exception $e ) {         // other error         echo 'other (session) request error: '.$e->getmessage();     } } if ( isset( $session ) ) {     // store session token php session     $_session['fb_token'] = $session->gettoken();     // , create new facebook session using cururent token     // or new token got after login     $session = new facebooksession( $session->gettoken() );     try {         // session post message own timeline         $request = new facebookrequest(             $session,             'post',             '/me/feed',             array(                 'link' => 'www.finalwebsites.com/facebook-api-php-tutorial/',                 'message' => 'a step step tutorial on how use facebook php sdk v4.0'             )         );         $response = $request->execute();         $graphobject = $response->getgraphobject();         // post response object         echo '<pre>' . print_r( $graphobject, 1 ) . '</pre>';         $msgid = $graphobject->getproperty('id');     } catch ( facebookrequestexception $e ) {         // show error facebook request         echo 'facebook (post) request error: '.$e->getmessage();     }     // create second request posted message in return     if ( isset ( $msgid ) ) {         // need sec. part of id         $parts = explode('_', $msgid);         try {             $request2 = new facebookrequest(                 $session,                 'get',                 '/'.$parts[1]             );             $response2 = $request2->execute();             $graphobject2 = $response2->getgraphobject();             // response object             echo '<pre>' . print_r( $graphobject2, 1 ) . '</pre>';         } catch ( facebookrequestexception $e ) {             // show error facebook request             echo 'facebook (get) request error: '.$e->getmessage();         }     } } else {     // need create new session, provide login link     echo 'no session, please <a href="'. $helper->getloginurl( array( 'publish_actions' ) ).'">login</a>.'; }  // use testing //unset($_session['fb_token']); 

thanks, mtj


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -