![]() |
|
[OMC] [Tutorial] Using the JSON RPC API (OmniCoind API) - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Money (https://hackforums.net/forumdisplay.php?fid=241) +--- Forum: Crypto Currency (https://hackforums.net/forumdisplay.php?fid=380) +--- Thread: [OMC] [Tutorial] Using the JSON RPC API (OmniCoind API) (/showthread.php?tid=4193030) |
[Tutorial] Using the JSON RPC API (OmniCoind API) - ScreamX - Apr 25, 2014 OmniCoind has remote procedure call function within it. This allows you to communicate with your OmniCoin daemon remotely. You can use this functionality to make things like wallets, block explorers, autobuy systems, etc. All you need is a little PHP knowledge. To make life really easy, we're going to use a library called jsonRPCClient. You can download it here. I used the lite version, inside the includes folder, you only need the file jsonRPCClient.php. Make sure your configuration of the server reflects that you want to allow RPC connection. Your config should be something like the one below. Your config file will be located at ~/.OmniCoin Code rpcuser=YOURUSERNAMECreate a new PHP file, in notepad or some other PHP text editor. Inside put the following. PHP Code After you have a successfuly connection, you can execute any command within the OmniCoin server simply by calling it directly. Example: (This command will print out the same data as it would from the server's command line directly. PHP Code Another Example: This snippet will pull the 10 most recent transactions, parse them and order them inside a table by the most recent transaction. PHP Code Thanks for reading, I hope it was useful. * - Linux. - Apr 25, 2014 Pretty good tutorial. You should have changed this to be config and rpc setup first then the actual client, and users shouldn't do * they should use their servers addresses. * - ScreamX - Apr 25, 2014 (Apr 25, 2014 11:11 AM)Linux. Wrote: Pretty good tutorial. You should have changed this to be config and rpc setup first then the actual client, and users shouldn't do * they should use their servers addresses. I flipped it around, because that does make sense. Also, I mentioned that under the config. * - chaddiablo - Apr 26, 2014 I can't seem to get it connected. I have checked if my port is open and it is. Here are my settings....of course i changed the pass... Code rpcuser=chaddiabloCode $omc = new jsonRPCClient("http://chaddiablo:[email protected]:43555/");Is there something wrong with this? Edit: Here is what shows up: Code Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://chaddiablo:[email protected]:4355' in /home3/dawk/public_html/classes/jsonRPCClient.class.php:140 Stack trace: #0 /home3/clfarmer/public_html/test.php(19): jsonRPCClient->__call('validateaddress', Array) #1 /home3/dawk/public_html/test.php(19): jsonRPCClient->validateaddress('oM8v179x5YrcGQu...') #2 {main} thrown in /home3/dawk/public_html/classes/jsonRPCClient.class.php on line 140Chad * - ScreamX - Apr 28, 2014 Your RPC port in the config is 43555, and in the error it says it's connecting to 4355. * - k6ng - Feb 8, 2016 I'm really lost... I don't understand what a "deamon" is... and what I need to do. I found a tutorial on how to make a gamble website but I'm totally lost. please pm me. |