M
Mark Volkmann
Can someone point me to an example of sending a POST request using Net::HTT=
P?
I found one at http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/=
Net/HTTP.html,
but this use the method post_data which, when I look at the source in
http.rb, is not a method of Net::HTTP. Maybe it's outdated
documentation.
This is what I've tried. I suspect I'm not passing the form data
correctly. The response is a Net::HTTPBadRequest.
---
require 'net/http'
host =3D 'www.runningbuzz.com'
Net::HTTP.start(host) do |http|
data =3D {
'CalcWhat' =3D> '2',
'timeH' =3D> '2',
'timeM' =3D> '57',
'timeS' =3D> '17',
'distance' =3D> '26.2',
'optDist' =3D> 'miles',
'optPace' =3D> 'miles'
}
response =3D http.post('pace_calculator.htm', data)
puts response.body
end
P?
I found one at http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/=
Net/HTTP.html,
but this use the method post_data which, when I look at the source in
http.rb, is not a method of Net::HTTP. Maybe it's outdated
documentation.
This is what I've tried. I suspect I'm not passing the form data
correctly. The response is a Net::HTTPBadRequest.
---
require 'net/http'
host =3D 'www.runningbuzz.com'
Net::HTTP.start(host) do |http|
data =3D {
'CalcWhat' =3D> '2',
'timeH' =3D> '2',
'timeM' =3D> '57',
'timeS' =3D> '17',
'distance' =3D> '26.2',
'optDist' =3D> 'miles',
'optPace' =3D> 'miles'
}
response =3D http.post('pace_calculator.htm', data)
puts response.body
end