how to send a post request and get the response in ruby
request is,
name=$name_val
URL is http://example.com/a/2
how do i do this in python or ruby?
how to send a post request and get the response in ruby
request is,
name=$name_val
URL is http://example.com/a/2
how do i do this in python or ruby?
To do this in python:
import urllib
data = urllib.urlencode({
"fieldName1" : "Val1",
"fieldName2" : "Val2",
"fieldName3" : "Val3"
})
f = urllib.urlopen("http://example.com/a/2", data)
html = f.read() # this is the response