I would like to know how to send and receive information through HTTP POST requests.
I am using Ruby v.1.8.7 and rails v.2.3.8.
EDIT:
My action code is as follows:
require 'net/http'
# get the url that we need to post to
url = URI.parse('http://localhost:3000/ipn/payments')
xml_notificaciones = "<NOTIFICACION><TIPONOTIFICACION>1</TIPONOTIFICACION><OPERACIONES><OPERACION><TIPO>1</TIPO><ID>31548</ID></OPERACION><OPERACION><TIPO>1</TIPO><ID>XA5547</ID></OPEARACION></OPERACIONES></NOTIFICACION>"
# build the params string
post_args1 = { 'NOTIFICACION' => xml_notificaciones }
# send the request
resp, data = Net::HTTP.post_form(url, post_args1)
When I execute the above code, the page will load for a while until I get the message execution expired.
I have a route record for http://localhost:3000/ipn/paymentsurl and the following:
map.received_ipn_payments '/ipn/payments', :controller => 'payments', :action => 'parse_received_data', :method => :post
I have it raise params.inspect, so I know when it works, but nothing so far ...
source
share