标签:get bug ruby star word method ice amp urlencode
def self.get_express_route_test
url = ‘http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService‘
xml = "<Request service=‘RouteService‘ lang=‘zh-CN‘><Head>4545</Head><Body><RouteRequest tracking_type=‘1‘ method_type=‘1‘ tracking_number=‘444003077898‘/></Body></Request>"
keyword = ‘dsadsa‘
md5_str = Digest::MD5.digest((xml + keyword).encode(‘utf-8‘))
verifyCode = Base64.strict_encode64(md5_str)
uri = URI.parse(url)
req = Net::HTTP::Post.new(uri.path,{‘Content-Type‘ => ‘application/x-www-form-urlencoded;charset=utf-8‘})
req.body = "xml=#{xml}&verifyCode=#{verifyCode}"
req = Net::HTTP.new(uri.host,uri.port).start{|http| http.request(req)}
Rails.logger.debug req.body
end
标签:get bug ruby star word method ice amp urlencode
原文地址:https://www.cnblogs.com/tomtang/p/9605834.html