Forum: Ruby on Rails How to connect to other server (Like cURL in php) in Ruby on

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Amjith (Guest)
on 2007-07-30 12:58
(Received via mailing list)
hi Friends,

i am a new programmer in Ruby On Rails, i need a help regarding

connecting to other server as cURL in php in ROR. so i hope got my
query.

that is i need to connect my page to other server to reteive some
information on that server. so how can i so that job in RoR?

give me a help please!

thanks and regards.
Amjith PS

removed_email_address@domain.invalid
+91 9388880335
JN_Coward (Guest)
on 2007-07-30 13:36
(Received via mailing list)
Hi Amjith,

Ruby (the language) gives you a few possibilities for connecting to a
remote server. For your needs you'll probably want Net::HTTP, also
check out the excellent open-uri. Both are included in the standard
Ruby dist, so just do:

require 'rubygems'
require 'open-uri'

thepage = open('http://someurl.com/mypage')

Rails (the framework) also comes with a library for consuming REST
based webservices, so if that's your thing you should check it out,
it's called active_resource.

/Jonas

P.S.: Some years ago two guys called Larry and Sergei started a rather
nifty website which helps in researching this sort of thing. Can't
seem to remember the name, has a lot of o's in it though.
This topic is locked and can not be replied to.