RubyCurl

RubyCurl is a simple way of getting html, xml or other text based files, into a variable, quick.

Install

To install RubyCurl simply..

sudo gem install rubycurl

=Simple Get

In your controller..

@curl = RubyCurl.new('http://github.com')

In your view..

<%= @curl.body %>

Even more simply, in your view just put

<%= RubyCurl.new('http://github.com').body %>

=Posting A Form

RubyCurl.post({'username' => 'arbarlow','password' => 'arbarlowpassword'}, 'http://example.com' )

=Get With HTTP Authentication

@curl = RubyCurl.auth ('username', 'password', "http://twitter.com/statuses/friends_timeline.xml" )

=Post With HTTP Authentication

RubyCurl.post_with_auth({'username' => 'yourusername', 'password' => 'yourpassword'}, {'param1' => 'param1text','param2' => 'param2text'}, 'http://example.com' )