我正在尝试使用facebook积分,但我收到了这个错误:
“您使用的应用没有响应。请稍后再试。”
我不知道是什么原因,
我查看了firebug控制台,看到一些长时间的请求需要40秒,请求目标是: http://0-if-w.channel.facebook.com/pull?channel=p_685255507& ; SEQ = 3及客户端ID = 25523dd1&安培; CB = gcgh&安培;空闲= 41&安培;状态=活性
有没有人知道我做错了什么?
这是我的HTML代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Facebook Credits Demo Application</title>
<meta property="og:title" content="yosi" />
<meta property="og:type" content="game" />
<meta property="og:url" content="http://localhost/ff_without/Facebook/default.aspx" />
<meta property="og:image" content="http://apps.facebook.com/yositestmylife/Media/Images/credit.png" />
<meta property="og:site_name" content="life2d0001" />
<meta property="fb:admins" content="685000507" />
<meta property="og:description"
content="A group of U.S. Marines, under command of
a renegade general, take over Alcatraz and
threaten San Francisco Bay with biological
weapons."/>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js">
</script>
</head>
<body>
<h2>
Facebook Credits Demo Application</h2>
<p>
Create an order by specifying the following attributes:</br> <i>Title, price, description,
image URL and product URL</i></p>
<!-- Please note that user can change any information in order_info through
javascript. So please make sure you never put price or any other
information you don't want users to modify in order_info. We put everything
here only for end-to-end flow testing purpose!! -->
<form name="place_order" id="order_form" action="#">
Title:
<input type="text" name="title" value="BFF Locket" id="title_el" />
<br />
<br />
Price:
<input type="text" name="price" value="10" id="price_el" />
<br />
<br />
Description:
<input type="text" name="description" size="64" value="This is a BFF Locket..." id="desc_el" />
<br />
<br />
Image URL:
<input type="text" name="image_url" size="64" value="http://localhost/ff_without/media/images/credit.png"
id="img_el" />
<br />
<br />
Product URL:
<input type="text" name="product_url" size="64" value="http://localhost/ff_without/facebook/Credit_buy.aspx"
id="product_el" />
<br />
<br />
<a onclick="placeOrder(); return false;">
<img src="http://www.facebook.com/connect/button.php?app_id=<%=appID%>&feature=payments&type=light_l">
</a>
</form>
<div id="output">
<%=htmlResponse%>
</div>
<br/><br/>
<div id="fb-root">
</div>
<script type="text/javascript">
FB.init({appId: <%=appID%>, status: true, cookie: true});
function placeOrder() {
var title = document.getElementById('title_el').value;
var desc = document.getElementById('desc_el').value;
var price = document.getElementById('price_el').value;
var img_url = document.getElementById('img_el').value;
var product_url = document.getElementById('product_el').value;
// Only send param data for sample. These parameters should be set
// in the callback.
var order_info = { "title":title,
"description":desc,
"price":price,
"image_url":img_url,
"product_url":product_url
};
// calling the API ...
// var obj = {
// method: 'pay',
// order_info: order_info,
// purchase_type: 'item'
// };
var obj = {
method: 'pay',
order_info: order_info,
purchase_type: 'item',
dev_purchase_params: {'oscif': true}
};
FB.ui(obj, callback);
}
var callback = function(data) {
//alert('ghg');
if (data['order_id']) {
writeback("Transaction Completed! </br></br>"
+ "Data returned from Facebook: </br>"
+ "<b>Order ID: </b>" + data['order_id'] + "</br>"
+ "<b>Status: </b>" + data['status']);
} else if (data['error_code']) {
writeback("Transaction Failed! </br></br>"
+ "Error message returned from Facebook:</br>"
+ data['error_message']);
} else {
writeback("Transaction failed!");
}
};
function writeback(str) {
document.getElementById('output').innerHTML=str;
}
</script>
</body>
</html>
答案 0 :(得分:1)
//更改了回调页面的编码。 如果您的回调页面是以UTF-8编码的,请检查它是否为没有BOM的UTF-8。
我认为这个主题解决了你的问题。希望能帮助到你: http://forum.developers.facebook.net/viewtopic.php?id=90781
答案 1 :(得分:1)
这可能是因为
答案 2 :(得分:0)
如果您使用来自Facebook Docs的callback.php示例,则注释掉26,32和第44行。
这将结束那种情况下的错误。
// if ($item_id == '1a') {
$item = array(
'title' => '100 some game cash',
'description' => 'Spend cash in some game.',
// Price must be denominated in credits.
'price' => 10,
//'image_url' => 'http://some_image_url/coin.jpg',
);
// Construct response.
$response = array(
'content' => array(
0 => $item,
),
'method' => $request_type,
);
// Response must be JSON encoded.
$response = json_encode($response);
//}