Douglas,
I dont know what error occurs, but how''bout this code?
require "uri"
require "net/http"
params = {"box1" => "Nothing is less important than which fork
you
use.
Etiquette is the science of living. It embraces everything. It is
ethics. It
is honor. -Emily Post", "button1" => "Submit"}
Net::HTTP.start(''http://localhost:3000'', 80) {|http|
response = http.post(''/'', params)
puts response.body
}
Hope this would work well.
On 1月31日, 午後11:10, Douglas Fonseca
<douglasinfo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> How can I send a post request to an external server from my app controller?
> I tried with this but didn''t work:
> require "uri"
> require "net/http"
> params = {"box1" => "Nothing is less important than which
fork you use.
> Etiquette is the science of living. It embraces everything. It is ethics.
It
> is honor. -Emily Post",
> "button1" => "Submit"}
> x =
Net::HTTP.post_form(URI.parse("http://localhost:3000"),params)
> puts x.body
> Thanks in advance!
> ---------------------------------------------------
> Douglas Fonseca
> Engenharia da Computação 2010
> Universidade Estadual de Campinas
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.