<profile-pic> fbml标签在iframe应用程序中无效</profile-pic>

时间:2011-02-07 13:12:20

标签: facebook facebook-graph-api

<?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']));
?>

//上面是我的facebook脚本

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

                    

代码之上是我的头脑

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

上面的代码是正文标记

<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 

1 个答案:

答案 0 :(得分:0)

对于iframe应用中的fbml标记,您可以试试这个

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