weixin_42654444
昨夜是今晨的开始
2018-11-14 06:14

用curl可以访问的地址内容,如何通过go语言的http包实现

20
  • Golang
  • curl
  • ea

比如我在命令行实现

 curl --data '{"jsonrpc":"1.0","id":"curltest","method":"getwalletinfo","params":[]}' http://user:123456@127.0.0.1:18332/

返回内容如

 {"result":{"walletname":"","walletversion":169900,"balance":0.00652964,"unconfirmed_balance":0.00000000,"immature_balance":0.00000000,"txcount":9,"keypoololdest":1541586836,"keypoolsize":1000,"keypoolsize_hd_internal":1000,"paytxfee":0.00000000,"hdseedid":"903b49b210bd3ef7e36326b34acdadff831ea1e0","hdmasterkeyid":"903b49b210bd3ef7e36326b34acdadff831ea1e0","private_keys_enabled":true},"error":null,"id":"curltest"}

我如何通过go语言来返回相同的内容?http.post函数能否完成,如果能完成需要怎么做?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐