Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of cURL for Ruby?

Tags:

curl

ruby

Is there a cURL library for Ruby?

like image 681
user85748 Avatar asked May 30 '09 12:05

user85748


People also ask

Is there a way to run curl command in Ruby?

Ruby has great gems like faraday, but in libraries and small utilities it's better to kill your dependencies and use what the stdlib provides. This tool turns a curl command into ruby (2.0+) code using net/http.

Is it possible to use net/http in Ruby?

Ruby's net/http is notorious for not having the friendliest API, but it isn't all that bad. Ruby has great gems like faraday, but in libraries and small utilities it's better to kill your dependencies and use what the stdlib provides. This tool turns a curl command into ruby (2.0+) code using net/http.

How do I make a curl request on GitHub?

2) Ctrl-click a request. 3) Click "Copy" > "Copy as cURL". 4) Paste it in the curl command box above. This also works in Safari and Firefox. GitHub is matching all contributions to this project on Github Sponsors . This is a surprisingly good deal and I'm not sure how long it's going to last.

How do I copy and paste a curl in GitHub?

2) Ctrl-click a request. 3) Click "Copy" > "Copy as cURL". 4) Paste it in the curl command box above. This also works in Safari and Firefox. GitHub is matching all contributions to this project on Github Sponsors .


3 Answers

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

like image 198
user1686 Avatar answered Nov 11 '22 06:11

user1686


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

like image 20
Skade Avatar answered Nov 11 '22 06:11

Skade


Use OpenURI and

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

accessing sites/pages/resources that require HTTP authentication.

like image 31
apostlion Avatar answered Nov 11 '22 08:11

apostlion