2011-09-20 23 views

回答

44

the documentation,您可以通过HTTP报头的哈希值作为第二个参数open

open("http://www.ruby-lang.org/en/", 
    "User-Agent" => "Ruby/#{RUBY_VERSION}", 
    "From" => "[email protected]", 
    "Referer" => "http://www.ruby-lang.org/") {|f| 
    # ... 
} 
+0

感谢像格式化造成的422错误帮助,谢谢,再次感谢。 – iwan