4

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',})

1 Answer 1

6

check out http://snippets.dzone.com/posts/show/6727

especially lines like:

req = Net::HTTP::Get.new(url.path)
req.add_field("X-Forwarded-For", "0.0.0.0")
Sign up to request clarification or add additional context in comments.

1 Comment

I don't understand how this answers the original question, since this example is for a Get request, but the original question was about how to send a post_form request. Am I missing something?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.