php - Facebook Tab with Fat Free Framework -


is there limitation fat free framework when try output page facebook tab?

i try below code, , unfortunately in facebook tab iframe empty blank page.

<?php  $f3=require('app/lib/base.php');  require_once 'app/lib/fb/facebook.php';  $f3->route('get /',     function() {         echo 'hello';     } ); $f3->route('get /landing',     function() {         $app_id = 'xxxx';         $secret_key = 'yyyy';         $page_id = 'zzzz';          $config = array(             'appid' => $app_id,             'secret' => $secret_key         );          $fb = new facebook($config);          $fbdata = $fb->getsignedrequest();          $fbinpage = false;         if(!empty($fbdata) && is_array($fbdata)             && !empty($fbdata['page']) && is_array($fbdata['page'])             && !empty($fbdata['page']['id'])         ) {             $fbinpage = $fbdata['page']['id'];         }          // check if user not in fb tab         if(!$fbinpage) {             // redirect facebook tab             echo '<script>window.location.href="https://www.facebook.com/'.                 $page_id.                 '?sk=app_'.                 $app_id.                 '"</script>';             exit;         }          // user id         $user = $fb->getuser();          // check if user not connected facebook         if ($user) {             try {                 $user_data = $fb->api("/me");             } catch (facebookapiexception $e) {                 $user_data = null;             }         } else {             // asking permission email , user_likes             $fb_login_url = $fb->getloginurl(array(                 'scope' => 'email, user_likes'             ));              echo '<script>top.location.href = "'.$fb_login_url.'"</script>';             exit;         }     } );  $f3->run(); 

first when user try access get /landing redirect facebook tab , show page get /. somehow return empty page, inspect firebug on firefox , there no error, on response tab shows reload page source for: https://localhost/f3-fb/. try office framework , works perfectly.

if ever problem please advise.

the problem in xframe, on default f3 set xframe value same-origin, based on doc, developer must overload value allow-from uri.

here full code index.php:

<?php  $f3=require('app/lib/base.php');  require_once 'app/lib/fb/facebook.php';  $f3->set('xframe', 'allow-from https://localhost/f3-fb/');  $f3->route('post /',     function() {         echo 'hello';     } );  $f3->route('get /landing',     function() {         $app_id = 'xxxx';         $secret_key = 'yyyy';         $page_id = 'zzzz';          $config = array(             'appid' => $app_id,             'secret' => $secret_key         );          $fb = new facebook($config);          $fbdata = $fb->getsignedrequest();          $fbinpage = false;         if(!empty($fbdata) && is_array($fbdata)             && !empty($fbdata['page']) && is_array($fbdata['page'])             && !empty($fbdata['page']['id'])         ) {             $fbinpage = $fbdata['page']['id'];         }          // check if user not in fb tab         if(!$fbinpage) {             // redirect facebook tab             echo '<script>window.location.href="https://www.facebook.com/'.                 $page_id.                 '?sk=app_'.                 $app_id.                 '"</script>';             exit;         }          // user id         $user = $fb->getuser();          // check if user not connected facebook         if ($user) {             try {                 $user_data = $fb->api("/me");             } catch (facebookapiexception $e) {                 $user_data = null;             }         } else {             // asking permission email , user_likes             $fb_login_url = $fb->getloginurl(array(                 'scope' => 'email, user_likes'             ));              echo '<script>top.location.href = "'.$fb_login_url.'"</script>';             exit;         }     } );  $f3->run(); 

add config $f3->set('xframe', 'allow-from https://localhost/f3-fb/'); allow url inside on facebook iframe.

and use post route inside facebook iframe (still don't know why must using f3, occur error , asking post route)


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -