Equivalent of cURL for Ruby?

前端 未结 12 2652
不知归路
不知归路 2020-11-29 00:33

Is there a cURL library for Ruby?

12条回答
  •  既然无缘
    2020-11-29 01:25

    To state the maybe-too-obvious, tick marks execute shell code in Ruby as well. Provided your Ruby code is running in a shell that has curl:

    puts `curl http://www.google.com?q=hello`
    

    or

    result = `
      curl -X POST https://www.myurl.com/users \
      -d "name=pat" \
      -d "age=21"
    ` 
    puts result
    

提交回复
热议问题