我有一個基於PHP的fb應用程序。一切運行良好,但我無法將故事發布到用戶的Feed中。我附上一些代碼,以便更好地理解...無法將Feed推送到publish_stream
編輯:問題是我無法顯示任何fbml/xfbml對話框。我可以從facebook上檢索信息,但fbml/xfbml不顯示。即使配置文件圖片沒有出現。
這是我想要推送Feed的index.php頁面。
<?php
include 'fb_init.php';
?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<!--Main Stylesheet -->
<head>
<link href="style/style-index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="JS/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="JS/fbml_init.js"></script>
</head>
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script>
<script type="text/javascript">
FB.init("API_KEY", "xd_receiver.php");
</script>
<fb:profile-pic facebook-logo="true" size="square" uid="loggedinuser" ></fb:profile-pic>
這是JavaScript fbml_init:
$(document).ready(function() {
//<![CDATA[
var who;
FB_RequireFeatures(["Api"], function(){
FB.Facebook.init('API_KEY', 'xd_receiver.htm');
var api = FB.Facebook.apiClient; // require user to login
api.requireLogin(function(exception)
{
FB.FBDebug.logLevel=1;
FB.FBDebug.dump("Current user id is " + api.get_session().uid);
});
var who = api.get_session().uid;
var notifications;
notifications = api.notifications_get(function(){});
var fql_loggeduser_name, fql_loggeduser_status;
FB.Facebook.apiClient.fql_query("select name, status, profile_update_time from user where uid = "+who,
function(rows) {
});
FB.Connect.showPermissionDialog("offline_access");
therestofthecode(who);
});
function therestofthecode(who){
//alert("the uid is: "+who);
//FB.apiClient.
}
function facebook_prompt_permission(permission) {
FB.ensureInit(function() {
FB.Connect.showPermissionDialog(permission);
});
}
//]]>
});
javascript函數上面只是以測試各種功能的原型。我想最終只使用它來推動飼料。出人意料的是,JavaScript是從Facebook拉動用戶信息就好了:
alt text http://img51.imageshack.us/img51/2974/screenshot20100210at112i.png
誰能告訴我它是什麼,我做錯了嗎?
它並不是顯示哪個權限對話框的情況。事情是我無法顯示對話框。任何對話框。 – amit 2010-02-11 16:31:45