问题
I'm trying to retrieve a set of values from a Quark blockchain (Quark is cryptocurrency like Bitcoin).
To those who don't know, the way that the blockchain works is if the given wallet address is QRHb2CTvGnwwrf6GHrxgQcH2tTAUoGhnC2 the blockchain has a way to display how much in total was received (or spent, or balance). Just click on the link below
http://176.221.46.81/chain/Quarkcoin/q/getreceivedbyaddress/QRHb2CTvGnwwrf6GHrxgQcH2tTAUoGhnC2
and you will see it print 41210004.6588
So what I want to do is:
the value in http://176.221.46.81/chain/Quarkcoin/q/getreceivedbyaddress/QRHb2CTvGnwwrf6GHrxgQcH2tTAUoGhnC2
minus
the value in http://176.221.46.81/chain/Quarkcoin/q/getsentbyaddress/QRHb2CTvGnwwrf6GHrxgQcH2tTAUoGhnC2
and to print the resulting $balance
What I want to do is the to import that value of how much has been pain in 41210004.6588 minus 17610004.6588 (how much has been paid out) and to print the Balance on my own website.
How can I do that with PHP? Can someone please help with the code?
回答1:
You want an HTTP client. Something that would allow you to fetch data from remote webpages.
You can use (from best to worst):
- A proper HTTP client library, like Artax.
 - cURL
 - file_get_contents()
 
来源:https://stackoverflow.com/questions/21331341/how-to-retrieve-a-value-from-a-blockchain-using-php