相当于PHP的ruby代码?

时间:2014-08-04 07:15:35

标签: php ruby

PHP的ruby代码的等价物?

PHP

$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign:'.$sign));
$execResult = curl_exec($ch);

RUBY

uri = "https://bleutrade.com/api/v2/market/buylimit?apikey=my_api_secret&market=LTC_BTC&quantity=0.023&rate=0.345"
sign_array = [{apisign:"#{sign}"}]

response = RestClient.post(uri, sign_array, "Content-Type" => "application/x-www-form-urlencoded")

当我运行我的服务器时,它会抛出"{\"success\":\"false\",\"message\":\"Invalid apikey or apisecret\",\"result\":[]}" error.

我检查了我的api密钥和密码是正确的但它不接受我请求获取信息的post http方法。我的等效代码是否正确?

0 个答案:

没有答案