List Info

Thread: Post to a remote page




Post to a remote page
user name
2006-04-29 13:57:59
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 
back.

Is it possible to do such a thing?

I hope that someone will be able to help me!

Thank you very much!

-- 
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
Post to a remote page
user name
2006-04-29 14:06:15
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.

On 4/29/06, Nauhaie <noe.cuneolaposte.net> wrote:
> 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
> back.
>
> Is it possible to do such a thing?
>
> I hope that someone will be able to help me!
>
> Thank you very much!
>
> --
> Posted via http://www.ruby-forum.com
/.
> _______________________________________________
> Rails mailing list
> Railslists.rubyonrails.org
> h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
>
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
Post to a remote page
user name
2006-04-30 21:36:18
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 
http
://www.rubycentral.com/book/lib_network.html for the
API.

-- 
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
Post to a remote page
user name
2006-04-30 21:56:52
Great!

Thanks a lot!

Nauhaie

-- 
Posted via http://www.ruby-forum.com
/.
_______________________________________________
Rails mailing list
Railslists.rubyonrails.org
h
ttp://lists.rubyonrails.org/mailman/listinfo/rails
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )