2011-09-20 21 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