Bitcoin Forum
July 27, 2024, 12:01:51 PM *
News: Help 1Dq create 15th anniversary forum artwork.
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Autoit Script to JSON RPC  (Read 2690 times)
tuheeden (OP)
Newbie
*
Offline Offline

Activity: 41
Merit: 0



View Profile
July 10, 2013, 05:58:44 PM
 #1

Everyone,

Since I could not find a working example of an JSON Autoit script, I created one and hopefully this will help others.

Keep in mind that you MUST edit the bitcoin.conf file set these lines:

 # server=1 tells Bitcoin-QT to accept JSON-RPC commands.
 server=1

 # You must set rpcuser and rpcpassword to secure the JSON-RPC api
 rpcuser=test
 rpcpassword=password

Additionally, if you use the bitcoind.exe program, you must start it with these options:
bitcoind.exe -daemon -conf=c:\temp\bitcoin.conf   (or whereever your .conf file is)


Enjoy:

$URL = "http://127.0.0.1:8332/"
Local $Data1='{"method":"getinfo","params":[],"id":"getinfo"}:'
Dim $obj = ObjCreate ("WinHttp.WinHttpRequest.5.1")
$obj.Open("POST", $URL, false)
$obj.SetCredentials("test","password",0)
$obj.SetRequestHeader("Content-Type", "application/json-rpc")
$obj.Send($Data1)
$oStatusCode = $obj.Status
MsgBox(0,"Response",$oStatusCode & "---" & $obj.ResponseText)
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!