HTTParty

The default HTTP libary in Ruby is pretty ugly. I don’t like it. I found HTTParty on rubygems and this is really easy to use. It is much better than the default HTTP API from ruby. Just add this to your Gemfile:

gem 'httparty', '0.7.4'

With one line you can fetch a site via GET.

html_body = HTTParty.get('http://www.yoursite.com').response.body

That’s it.

Published by Robert Reiz

CEO @ VersionEye. Passionated software developer since 1998.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: