开发者

NO FBML is working in iframe in facebook using PHP (ie or ff or anywhere else!)

开发者 https://www.devze.com 2022-12-25 02:24 出处:网络
I have tried for three days now and gotten nowhere on this.... I absolutely can not get any \"fb:\" code to render anything! I\'ve tried the exact code in the sandbox and it works fine. I\'ve read thr

I have tried for three days now and gotten nowhere on this.... I absolutely can not get any "fb:" code to render anything! I've tried the exact code in the sandbox and it works fine. I've read through every search result I could find and gotten nowhere...

I'm using a standard xd_receiver page, and in the body there's this line:

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

Here's my index page. It's basically the stock facebook example code....

<?php
require_once 'facebook-platform/php/facebook.php';

//Authentication Keys
$appapikey = 'MY_KEY';         // obviously this is my real key
$appsecret = 'MY_SECRET';      // same thing

$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();
?>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
 <head></head>
 <body>
  <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>

<?
   echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\"></fb:name>!</p>";

?>

  <script type="text/javascript">
  FB_RequireFeatures(["XFBML"], function(){
   FB.Facebook.init("<?php echo $appapikey; ?>", "xd_receiver.htm");
  });
  </script>
 </body>
</html>

oddly enough, when I put this code below where it echos the logged in user's name, it does show the id numbers of friends. But again, it won't render their names

<?php
   friends.get API method echo "<p>Friends:";
   $friends = $facebook->api_client->friends_get();
   $friends = array_slice($friends, 0, 25);
   foreach ($friends as $friend) {
      echo "<br>".$friend." - <fb:name uid=\".$user_id.\" useyou=\"false\"></fb:name>";
   }
   echo "</p>";
?>

Here's my settings:

Canvas Callback URL http://www.my-actual-website.com/test/

Canvas URL http://apps.facebook开发者_如何学C.com/gogre_testapp/

FBML/iframe iframe

Application Type Website

Post-Remove URL http://www.my-actual-website.com/test/

Post-Authorize URL http://www.my-actual-website.com/test/

Please, somebody help me out! I've been trying unsuccessfully for days


XFBML problems are often a result of Facebook being unable to access your xd_receiver.htm file. Try putting the full URL to xd_receiver.htm, ie. http://yourdomain.com/xd_receiver.htm in the FB.Facebook.init line, and make sure that the file is being served properly by accessing it manually.

The other thing that will definitely cause this is failing to set the Connect URL in your app settings. Go to the Developer app and edit your settings. Under the Connect options, set the Connect URL to your main site, ie. http://yourdomain.com/.

0

精彩评论

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