【发布时间】:2014-09-24 03:09:56
【问题描述】:
function Autobuy(id, price){
$.ajax({
type: "GET",
url: "http://m.roblox.com/Catalog/VerifyPurchase?assetid=" + id + "&type=robux&expectedPrice=" + price,
success: function(Data){
var Regex = /__RequestVerificationToken" type="hidden" value="(.+)" \/>/
var Verify = Data.match(Regex)[1]
$.ajax({
type: "POST",
url: "http://m.roblox.com/Catalog/ProcessPurchase",
__RequestVerificationToken: Verify,
CurrencyType: 1,
AssetID: id,
ExpectedPrice: price
});
}
});
};
例如,当我尝试使用该代码时: 自动购买(163500995, 85), 我收到这个错误 POST http://m.roblox.com/Catalog/ProcessPurchase 500(内部服务器错误)
我基本上是想把这段代码变成 $.ajax
function AutoBuy(ID, Price){
$.get("http://m.roblox.com/Catalog/VerifyPurchase?assetid=" + ID + "&type=robux&expectedPrice=" + Price, function(Data){
var Regex = /__RequestVerificationToken" type="hidden" value="(.+)" \/>/
var Verify = Data.match(Regex)[1]
var post = $.post("http://m.roblox.com/Catalog/ProcessPurchase", {
__RequestVerificationToken: Verify,
CurrencyType: 1,
AssetID: ID,
ExpectedPrice: Price
});
});
};
【问题讨论】:
-
服务器错误,例如,不是“客户端”。是他们的问题。这是您正在使用的他们的官方 API,还是只是您试图抓取他们的页面?
-
这个问题似乎跑题了,因为它是关于第三方服务器上的服务器错误。
-
@Daedalus 但它可以与 $.post 一起使用,所以我很困惑,我之前没有看到编辑,是的,这是我正在使用的他们的官方 API。
-
@user3897713 请链接到文档。
-
代码看起来很相似,所以区别肯定在细节上,使用像ZAP、Charles或Fiddler这样的跟踪代理。或者在浏览器网络监视器中检查请求。 get 是否提供了正确的数据?也许 get 响应是 HTML,因此没有显示在 Ajax 数据回调中?