tags:

views:

3039

answers:

6

Is there a curl library for Ruby?

+16  A: 

Curb and Curl::Multi provide cURL bindings for Ruby.

grawity
+5  A: 

Use open-uri and

  open("http://...", :http_basic_authentication=>[user, password])

accessing sites/pages/resources that require HTTP authentication.

apostlion
Honestly, if I see that a library uses open-uri internally, I don't use that library. It's a deeply flawed library built on top of a deeply flawed URI parser. It's fine for usage in IRB and that's it.
Bob Aman
@Sporkmonger: Well, that's what we have— what do you suggest, raw Net::HTTP?
apostlion
Use Net::HTTP or Patron or Curb or any of the other libraries mentioned in the other answers. How this answer got voted up or accepted is beyond me.
Bob Aman
+4  A: 

If you like it less low-level, there is also Typhoeus, which is built on top of Curl::Multi.

Skade
I wonder why you got thumbed down?
method
+1  A: 

There's also mechanize, very high-level web scraping client, uses Nokogiri for html parsing.

method
+3  A: 

You might also have a look at Rest-Client

QAD
+3  A: 

Curb-fu is a wrapper around Curb which in turn uses libcurl. What does Curb-fu offer over Curb? Just a lot of syntactic sugar - but that can be often what you need.

Peter Cooper