How to retrieve a value from a Blockchain using PHP?

风格不统一 提交于 2019-12-20 07:12:34

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!