How to get current BTC rate for BRL(real) using php cURL or javascript

0

1

Is there anyway to get current rate of BRL = BTC.

I saw the blockchiain ticker. But the value for BRL currency is not updated As listed here in preev. I want to get the

 current 1BTC= how much BRL

Thanks in advance!

sandip

Posted 2013-05-13T11:56:14.560

Reputation: 101

What do you mean that it's not updated?Nick ODell 2013-05-13T15:25:48.053

@NickODell as the bitcoin value keep fluctuating, accordingly the value of the BRL currency also changing so this value is not shown as it changes.sandip 2013-05-14T09:48:12.440

There are actually a couple of Brazilian exchanges that publish rates, but what they're not doing is providing an API. That's going to make it more difficult to curl in.Yitzhak 2014-03-04T02:01:04.577

Something you could do is use the btc-e api to get the bitcoin to dollars or euros price, and find a forex api that does dollars or euros to Real, and mash the whole thing together.Yitzhak 2014-03-04T02:02:36.140

@DoctorEvil Bitcoin is overcharged in Brazil, so your procedure won't return the actual price there. Mercado Bitcoin now has an API, see my answer.Felipe Voloch 2014-06-02T13:08:14.310

Answers

2

BitPay have a JSON API on https://bitpay.com/api/rates
You can get BRL value with this command and calculate, (this API update every 1 minute)

curl -ks https://bitpay.com/api/rates | python -m json.tool | grep -iA 1 'Brasilian Real' | grep -i 'rate' | cut -f2 -d ':' | tr -d ' '

You will need:
- CURL
- Python 2.7+
- grep + cut + tr

Thiago Pereira

Posted 2013-05-13T11:56:14.560

Reputation: 21

1

This is a simple way to print the value of 1 BTC in BRL with PHP.

You could manipulate the string containing the value for 1 BTC in BRL further if you need.

<?php

$jsnsrc = "https://blockchain.info/ticker";
$json = file_get_contents($jsnsrc);
$json = json_decode($json);
$one_Btc_To_Brl = $json->BRL->last;

print "1 BTC = " . $one_Btc_to_Brl;
?>

Dhuum

Posted 2013-05-13T11:56:14.560

Reputation: 229

why Thiago Pereira answer requires so many additional setup but yours just plain PHP?4 Leave Cover 2016-10-26T16:16:48.347

0

Try this currency converter site, they might have updated rates for BRL = BTC

Arnold

Posted 2013-05-13T11:56:14.560

Reputation: 3

0

You could start by parsing the JSON here:

https://bitpay.com/bitcoin-exchange-rates

Avram

Posted 2013-05-13T11:56:14.560

Reputation: 1 629

0

wget --no-check-certificate https://www.mercadobitcoin.com.br/api/ticker/

returns data that can be parsed relatively easily.

Felipe Voloch

Posted 2013-05-13T11:56:14.560

Reputation: 226