在 Ruby 中使用 Net::HTTP 创建带有标头信息的 HTTP POST 请求
我试图以编程方式发布到互联网上的 html 表单。我已设法在请求正文中创建一个带有参数的请求,但我不知道如何使用 Net::Http 库传入 Http 标头属性。如果这可能的话有什么想法吗?...还有其他图书馆可以为我做这件事吗?
res = Net::HTTP.post_form(URI.parse('http://test.com/add_comment'),
{'static'=>'1', 'entry_id'=>'23942',})
Im trying to programmatically post to an html form on the internet.I have managed to create a request with parameters in the request body but I can't figure out how to pass in Http Header attributes using the Net::Http library. Any ideas if this is possible?... Any other library that would do it for me ?
res = Net::HTTP.post_form(URI.parse('http://test.com/add_comment'),
{'static'=>'1', 'entry_id'=>'23942',})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 http://snippets.dzone.com/posts/show/6727
特别是行喜欢:
check out http://snippets.dzone.com/posts/show/6727
especially lines like: