ruby的json请求
require 'net/http'
require 'uri'
require 'json'
customers = [{
"id" => 1123,
"name" => "B-abc",
"citys" => "",
"company" => "",
"siteUrl" => "www.abc.com",
"domain" => "www.abc.com",
"contact" => "张三",
"phone" => "12222222",
"mobilePhone" => "",
"mail" => "",
"status" => 1
}].to_json
def send_data(url,data)
url = URI.parse(url)
req = Net::HTTP::Post.new(url.path,{'Content-Type' => 'application/json'})
req.body = data
res = Net::HTTP.new(url.host,url.port).start{|http| http.request(req)}
puts res.body
end
点亮测试人生!QQ:408129370
百度阅读电子书地址:http://yuedu.baidu.com/ebook/f6dbb2a2f01dc281e53af0f3
讨论QQ群:536192476
个人公众号:
百度阅读电子书地址:http://yuedu.baidu.com/ebook/f6dbb2a2f01dc281e53af0f3
讨论QQ群:536192476
个人公众号: