curl을 이용하여 다음과 같이 geth에 rpc를 호출 할 수 있다.
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://192.168.0.35:8545
power shell에서 다음과 같이 curl을 흉내 냈다.
$R=Invoke-WebRequest http://192.168.0.35:8545 -SessionVariable fb -method post -body $body -contenttype "application/json"
이것은 표준 프로토콜로 하면 다음과 같다.
POST HTTP/1.1
Host: 192.168.0.35:8545
Content-Type: application/json
Cache-Control: no-cache
[{"jsonrpc":"2.0", "method":"web3_clientVersion", "params":[], "id":1100}]
포스트맨에서 위와 같이 설정하고 send를 누르면 동일한 결과같을 얻을 수 있다.
'통합개발' 카테고리의 다른 글
Powershell에서 curl 사용하기 (0) | 2018.03.21 |
---|