当我发出http请求时,我收到一个奇怪的错误.
请求代码是这样的;
purchase_xml = Transaction.yo_xml(api_username,api_password,@total, account, merchant_reference)
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
request.body = purchase_xml
response = http.request(request)
result = Hash.from_xml(response.body)
Run Code Online (Sandbox Code Playgroud)
yo_xml看起来像这样;
def self.yo_xml(api_username, api_password,amount, account, transaction_id)
xml = "<?xml version=1.0 encoding=UTF-8?><AutoCreate><Request><APIUsername>#{api_username}</APIUsername>
<APIPassword>#{api_password}</APIPassword><Method>acdepositfunds</Method><Amount>#{amount}</Amount>
<Account>#{account}</Account><Narrative>Purchase of SMS</Narrative><InternalReference>#{transaction_id}</InternalReference>
<ExternalReference>#{transaction_id}</ExternalReference><ProviderReferenceText>Thank you for using Skyline SMS</ProviderReferenceText>
</Request></AutoCreate>"
return xml
end
Run Code Online (Sandbox Code Playgroud)
我收到这个错误;
Net::HTTPBadResponse
wrong status line: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">"
Run Code Online (Sandbox Code Playgroud)
提出这条线
response = http.request(request)
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.
以下jquery脚本在firefox中不起作用.谁知道如何纠正它?
$(document).ready(function () {
$('#all_lists').hide();
$('#add_lists').click( function(){
event.stopPropagation();
$('#all_lists').toggle();
});
$(document).click( function(){
$('#all_lists').hide();
});
});
Run Code Online (Sandbox Code Playgroud) 我有哈希:
request = {"AutoCreate"=>{"Response"=>{"Status"=>"OK", "StatusCode"=>"0", "TransactionStatus"=>"SUCCEEDED", "TransactionReference"=>"MxhRNvs5EuJLTEkhKqO5Olgk2zMtYMTOI0IvQInWPV8EYsWAI7Aji09B3B8Bigzkee20e3bc4bd9eab997d7825b883b7359"}}}
Run Code Online (Sandbox Code Playgroud)
如何访问的散列值"Status","StatusCode"和"TransactionStatus"?
如何在 Rails 应用程序上创建动态 QR 码,以便在扫描并成功处理它时,带有 QR 码的打开页面可以重定向到成功页面。
这类似于 Whatsapp Web 实现,其中 Android 应用程序扫描 QR 码时,页面会加载消息。
我更感兴趣的是会议的管理。扫描 QR 后,我能够重新加载显示该 QR 的页面,然后重定向到另一个页面。任何想法?