Bitcoin Forum
May 22, 2024, 03:07:36 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Html. API info pull  (Read 1129 times)
vm1990 (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1002



View Profile
February 28, 2015, 09:33:29 PM
 #1

i couldnt what to call this but here goes

is there a way using HTML code (like in wordpress) to pull and display wallet info on a website.

so website would connect to the server running the wallet and get info such as connections, last block, online/offline

Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
March 01, 2015, 10:29:57 PM
 #2

No.

HTML is a language for website structure and layout, it doesn't provide features for interactivity. For that, you need to use a scripting language such as JavaScript (client side) or PHP (server side).
EcuaMobi
Legendary
*
Offline Offline

Activity: 1862
Merit: 1469


https://Ecua.Mobi


View Profile WWW
March 01, 2015, 10:32:50 PM
 #3

Pure HTML? No, definitely no.

However you can do this:

- Install the wallet and enable RPC.
- Write a simple PHP script that connects via RPC (using jsonrpcphp for example) and displays it as json.
- Write a simple javacript code using jQuery that connects to that PHP and dynamically updates the HTML.

Newar
Legendary
*
Offline Offline

Activity: 1358
Merit: 1001


https://gliph.me/hUF


View Profile
March 02, 2015, 11:13:17 AM
 #4

@Morblias came up with a solution for python to write the html: http://pastebin.com/MGu1iBkH (scroll about half way down). The result is something like this: http://192.227.139.229/ . It's a bit dated, so might need some adjustments.


A very basic hack could be to pipe the output of the RPC calls to a simple HTML file. For example getinfo command:
Code:
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  <TITLE>Bitcoin Node</TITLE>
{
"version" : 100000,
"protocolversion" : 70002,
"walletversion" : 60000,
"balance" : 0.26397973,
"blocks" : 345815,
"timeoffset" : 0,
"connections" : 8,
"proxy" : "",
"difficulty" : 46684376316.86029053,
"testnet" : false,
"keypoololdest" : 1397008447,
"keypoolsize" : 100,
"unlocked_until" : 0,
"paytxfee" : 0.00001000,
"relayfee" : 0.00001000,
"errors" : ""
}

Then have a cronjob to run it every x minutes etc. Have another cronjob just before to remove the old file and create a new one with the HTML3.2 header. Probably you'll want to put it all in one script. It won't look pretty, but the info is there.


PS: Picked HTML3.2 because the specs say:
Quote
In practice, the HTML, HEAD and BODY start and end tags can be omitted from the markup as these can be inferred in all cases by parsers conforming to the HTML 3.2 DTD.

OTC rating | GPG keyid 1DC91318EE785FDE | Gliph: lightning bicycle tree music | Mycelium, a swift & secure Bitcoin client for Android | LocalBitcoins
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!