开发者

<profile-pic> fbml tag not working in iframe application

开发者 https://www.devze.com 2023-02-08 19:57 出处:网络
<?php include_once \'config.inc.php\'; function get_facebook_cookie($app_id, $app_secret) { $args = array();
<?php


include_once 'config.inc.php';

function get_facebook_cookie($app_id, $app_secret) {
  $args = array();
  parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
  ksort($args);
  $payload = '';
  foreach ($args as $key => $value) {
    if ($key != 'sig') {
      $payload .= 开发者_高级运维$key . '=' . $value;
    }
  }
  if (md5($payload . $app_secret) != $args['sig']) {
    return null;
  }
  return $args;
}

$cookie = get_facebook_cookie(174346302604624, be273568bf3e3b6c194fdcc09448201d);
//catch the exception that gets thrown if the cookie has an invalid session_key in it
$user = json_decode(file_get_contents(
    'https://graph.facebook.com/me?access_token=' .
    $cookie['access_token']));
?>

//above is MY facebook script

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

above the code is in my head

<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js"  
    type="text/javascript"></script>

above code is in body tag

<div><fb:profile-pic uid='<?php echo $user->id; ?>' ></fb:profile-pic></div>       

<?php } ?>
<div id="fb-root"></div>
<script>
  FB.init({appId: '<?= 174346302604624 ?>',status: true,
           cookie: true, xfbml: true});
  FB.Event.subscribe('auth.login',function(response) {
    window.location.reload();
  });

</script>



       above code is just before </body> tag can any body tell me what is fault,i want to show profile pic 


for fbml tags in iframe app you can try this one

<fb:serverFbml>  
    <script type="text/fbml">
        <fb:fbml>
            <div><fb:profile-pic uid=""></fb:profile-pic></div> 
        </fb:fbml>
    </script>
</fb:serverFbml>
0

精彩评论

暂无评论...
验证码 换一张
取 消