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(‘github.com’) In your view..

<%= @curl.body %> Even more simply, in your view just put

<%= RubyCurl.new(‘github.com’).body %>

Posting A Form

RubyCurl.post(=> ‘arbarlow’,‘password’ => ‘arbarlowpassword’, ‘example.com’ )

Get With HTTP Authentication

@curl = RubyCurl.auth (‘username’, ‘password’, “twitter.com/statuses/friends_timeline.xml” )

Post With HTTP Authentication

RubyCurl.post_with_auth(=> ‘yourusername’, ‘password’ => ‘yourpassword’, => ‘param1text’,‘param2’ => ‘param2text’, ‘example.com’ )