Author

Topic: Autoit Script to JSON RPC (Read 2690 times)

newbie
Activity: 41
Merit: 0
July 10, 2013, 01: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)
Jump to: