How to get current value of bitcoin?

0 votes

I want to get the current bitcoin price when I call a function. I found https://mtgox.com/api/0/data/ticker.php but it returns

{"ticker":{"high":12.43,"low":11.7,"avg":12.10615987,"vwap":12.098317306,"vol":58453,"last_all":12.34351,"last_local":12.34351,"last":12.34351,"buy":12.3341,"sell":12.34351}}

How can I set a PHP variable to just the value of last_all (12.34351)

Aug 20, 2018 in Blockchain by slayer
• 29,050 points
49 views

1 answer to this question.

0 votes

You can use json_decode to transform it into a PHP object.

$content = json_decode($string, true);

echo $content["last_all"];
answered Aug 20, 2018 by digger
• 27,630 points

Related Questions In Blockchain

0 votes
1 answer

How to get the current state of a smart contract?

Hey, you gotta provide the contract code, and ...READ MORE

answered Aug 1, 2018 in Blockchain by Perry
• 17,020 points
48 views
0 votes
1 answer

How to get the number of tokens in the Bitcoin network?

This information can easily be calculated by ...READ MORE

answered Aug 31, 2018 in Blockchain by Christine
• 15,790 points
28 views
0 votes
1 answer

How to get current block number in parity?

You can get the latest block number ...READ MORE

answered Jun 8, 2018 in Blockchain by Christine
• 15,790 points
195 views
0 votes
1 answer

how to get modification history of asset?

You can use GetHistoryForKey() API as shown ...READ MORE

answered Jul 9, 2018 in Blockchain by digger
• 27,630 points
327 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 27,630 points
2,922 views
0 votes
1 answer

Cant make transactions in bitcoind.

Fist you should encrypt your wallet: bitcoin-cli encryptwallet ...READ MORE

answered Aug 23, 2018 in Blockchain by slayer
• 29,050 points
44 views
0 votes
1 answer

How to create Bitcoin Address in PHP?

You need to understand that Bitcoin address and ...READ MORE

answered Aug 27, 2018 in Blockchain by Perry
• 17,020 points
430 views
0 votes
1 answer

How to get return value of external function?

You can do this. I have shared ...READ MORE

answered Aug 13, 2018 in Blockchain by digger
• 27,630 points
25 views
0 votes
1 answer

How to get genesis block value at new bitcoin source?

chainparams.cpp contains a line of code that ...READ MORE

answered Sep 4, 2018 in Blockchain by digger
• 27,630 points
64 views