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,350 points
618 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
• 26,740 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,100 points
947 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
922 views
0 votes
0 answers

How to get AUD price of bitcoin at a particular date

I am trying to find out how ...READ MORE

Mar 1, 2022 in Blockchain by Soham
• 9,700 points
318 views
0 votes
0 answers

How to get Bitcoin value for corresponding USD value in ASP.NET C#?

I want to get the Bitcoin value ...READ MORE

Mar 1, 2022 in Blockchain by Soham
• 9,700 points
705 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
• 26,740 points
44,440 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,350 points
594 views
0 votes
1 answer

How to create Bitcoin Address in PHP?

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

answered Aug 28, 2018 in Blockchain by Perry
• 17,100 points
5,165 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
• 26,740 points
1,727 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
• 26,740 points
844 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP