Forum: Ruby on Rails Post to a remote page

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ecf21acef6f0e0d734051c7392207d2f?d=identicon&s=25 Nauhaie (Guest)
on 2006-04-29 15:57
Hi all,

I am sorry if this question has already been replied here, but I did not
manage to find an answer.

I am looking for a way to post data to a remote web page. I don't want
to use hidden fields and a submit button, I would just like some ruby
code that would post parametres to a web page and store the web page
that the remote server sends back.

I am not sure that I have been clear, so, here is an example.

I have a simple page on a php server B that contains the code

print ($_POST['var1']+$_POST['var1']);

And I have my ruby server A, and what I would like to do is post var1
and var2 to server B and store the answer (A+B) that server B gives me

Is it possible to do such a thing?

I hope that someone will be able to help me!

Thank you very much!
Fb23bc8cd4030c526b0689276b34c8bd?d=identicon&s=25 Bryan Duxbury (bryanduxbury)
on 2006-04-30 23:36
You can use Net::HTTP to do an HTTP transfer inside of one of your
scripts, and then save the result. I've never done it, but honestly, it
shouldn't be hard. Check for the API.
Ecf21acef6f0e0d734051c7392207d2f?d=identicon&s=25 Nauhaie (Guest)
on 2006-04-30 23:56

Thanks a lot!

2c80e1b0837eec76d38d4f7fa1c15e87?d=identicon&s=25 Michael Gorsuch (Guest)
on 2006-05-03 19:08
(Received via mailing list)
Are you bound to POST?  You could use a REST-like approach and hit the
remote page with GET requests via net/http and parse the response.
This topic is locked and can not be replied to.