Rails 实现页面的基本认证 (Basic Authentication)

2015-10-04 0 352
Rails 实现页面的基本认证 (Basic Authentication)
require 'net/http'

url = URI.parse('http://www.rubyinside.com/test.txt')

Net::HTTP.start(url.host, url.port) do |http|
  req = Net::HTTP::Get.new(url.path)
  req.basic_auth('username', 'password')
  puts http.request(req).body
end

遇见资源网 ruby Rails 实现页面的基本认证 (Basic Authentication) http://www.ox520.com/16496.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务