Lar*_*ien 31
require 'net/http'
port = 8080
host = "127.0.0.1"
path = "/Application?key=apikey&id=id&option=enable"
req = Net::HTTP::Put.new(path, initheader = { 'Content-Type' => 'text/plain'})
req.body = "whatever"
response = Net::HTTP.new(host, port).start {|http| http.request(req) }
puts response.code
Run Code Online (Sandbox Code Playgroud)
拉里的回答帮助我指明了正确的方向.多一点挖掘帮助我找到了这个答案引导的更优雅的解决方案.
http = Net::HTTP.new('www.mywebsite.com', port)
response = http.send_request('PUT', '/path/from/host?id=id&option=enable|disable')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19475 次 |
| 最近记录: |