简体   繁体   English

如何在Rails应用程序中使用curl

[英]How to use curl in rails app

I have curl str 我有卷曲

 curl -L –user '61332:Ne5re3w34fa' -H «Content-Type: application/json» -d '{«confirmed_at»: {«date»:«2014-04-30», «period»: 30}, «merchant_id»:73, «state»:[3,4], «type»: 0, «sub_id»:«test»}' -X POST https://myurl/

which returns me data in console 这会在控制台中返回我的数据

But how to use it inside rails app? 但是如何在Rails应用程序中使用它呢?

Ruby stdlib has opportunity to run system commands Ruby stdlib有机会运行系统命令

Here is good review of all possible variants: Calling shell commands from Ruby 这是所有可能的变体的很好的回顾: 从Ruby调用shell命令

Also there is curl gem: https://rubygems.org/gems/curb 也有卷曲宝石: https : //rubygems.org/gems/curb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM