1

I've been using Ruby for quite some time now, however unlike PHP, as far as I know there is not a standard http/Curl (fetching, processing forms) like library that is easy and powerful like PHP's libCuRL binding.

While Net::HTTP is part of the Ruby standard library, I always find that API hard to remember and program with.

Can anyone give suggestions on which http/curl library I should use over Net::HTTP?

4 Answers 4

2

Take a look at HTTParty or REST Client.

Sign up to request clarification or add additional context in comments.

Comments

1

I would recommend using the Typhoeus gem. It's got a pretty clean API and allows you to make concurrent requests.

1 Comment

Paul Dix, the original author of Typhoeus, has a blog article comparing several different clients.
0

I'll second Ryan's recommendation for Typhoeus, and recommend HTTPClient also. Both are very full featured and handle parallel requests easily.

For simple requests it's hard to beat Open-URI for its simplicity:

require 'open-uri'
html = open('http://www.example.com').read

If you're parsing a page it works great with Nokogiri:

require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open('http://www.example.com'))

Comments

0

I wrote a wrapper for the Net:HTTP lib recently, its very very simplistic. I wanted something with a simple API that was easy to use and remember, it's been working well for me:

https://github.com/ctcherry/plain_http

1 Comment

I might ended up using your module. Given how simple it is and the segment errors that I'm getting with Typhoeus on Ruby 1.9.2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.