Bitcoin Forum
June 24, 2024, 06:05:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: jsonPRC Client & Server Implementation (Hello World!)  (Read 448 times)
airborne305 (OP)
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
April 15, 2013, 03:34:27 AM
 #1

*** Newbie here - Second Post ***

I kind of dove into the whole bitcoin/p2pool/LAMP thing late last week, so i'm sure i'm in over my head here.

I have read over https://en.bitcoin.it/wiki/PHP_developer_intro and https://en.bitcoin.it/wiki/API_reference_(JSON-RPC) which are great, but don't really provide much info for the complete newbies.

I'm stuck at "Hello World." i followed the instructions. But I would like a little more detail/instruction of proper placement and implementation of the JSON RPC Client and Server. When following the instruction, i get the below response in the browser. [I do change the username/password/port info].

Response i get
Code:
[left][center]require_once 'jsonRPCClient.php'; $bitcoin = new jsonRPCClient('http://user:password@127.0.0.1:8332/'); echo "
\n";
  print_r($bitcoin->getinfo());
  echo "
";[/center][/left]
I'm also looking for advise on retrieving the information. Example, i want to post info from bitcoin and post it on a site. Would it be more practical to have my webpage (PHP) pull the information directly and post it on the page? or would it be a better idea to have Python (or even PHP) running in the back-end updating a mySQL database, and the website pull the information from the DB?


OdinHephaestus
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 15, 2013, 05:05:35 AM
 #2

I'm also looking for advise on retrieving the information. Example, i want to post info from bitcoin and post it on a site. Would it be more practical to have my webpage (PHP) pull the information directly and post it on the page? or would it be a better idea to have Python (or even PHP) running in the back-end updating a mySQL database, and the website pull the information from the DB?

Honestly, it doesn't really matter, because no matter where your code is (in the same file as your html, or a separate php file), it is still running on the server.  The only time it really matter is if you plan on implementing AJAX, but seeing as your first JSON-RPC attempt as to ignore the server, and just write "Hello World" onto the screen, I doubt will be wanting to try this at the moment.

When working with JSON-RPC, it's best to just think of it as talking to the bitcoind server though a 3rd-party.  Anything you can do in the terminal with bitcoind (run "bitcoind help" for a list of functions), you can do with JSON-RPC.
Assuming all your working with is bitcoin addresses/accounts, their balances, and sending/receiving transactions, then you have no need for a mySQL table, as all the info is kept with bitcoind.

Bitcoin: 1odinQ5YUdbfuopNF2D1FZRN8qcrC4y1L
Litecoin: LeodinXzG7CgHqPDZxaUgsDKUKBUu46qa5
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!