Guest User

Untitled

a guest
Apr 3rd, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. rpcuser=usernamebitcoin
  2. rpcpassword=mypasswordbitcoin
  3. rpcallowip=127.0.0.1
  4. rpcallowip=xxx.xxx.xxx.xxx
  5. rpcallowip=xxx.xxx.xxx.xxx
  6. rpcport=8332
  7. server=1
  8. daemon=1
  9. listen=1
  10. txindex=1
  11.  
  12. curl --user usernamebitcoin --data-binary '{"jsonrpc": "1", "id":"", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain' http://xxx.xxx.xxx.xxx:8332/
  13.  
  14. <?php
  15.  
  16. $postfields = [
  17. 'jsonrpc' => '1',
  18. 'id' => '',
  19. 'method' => '',
  20. 'getbalance' => '',
  21. 'params' => [],
  22. ];
  23. $ch = curl_init();
  24. curl_setopt($ch, CURLOPT_URL, "http://xxx.xxx.xxx.xxx:8332/" );
  25. curl_setopt($ch, CURLOPT_USERPWD, "usernamebitcoin:mypasswordbitcoin");
  26. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
  27. curl_setopt($ch, CURLOPT_POST, 1 );
  28. curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
  29. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
  30.  
  31. $output = curl_exec($ch);
  32. $info = curl_getinfo($ch);
  33. echo "<pre>";
  34. print_r($info);
  35. curl_close($ch);
  36.  
  37. ?>
  38.  
  39. Array
  40. (
  41. [url] => http://xxx.xxx.xxx.xxx:8332/
  42. [content_type] => application/json
  43. [http_code] => 500
  44. [header_size] => 152
  45. [request_size] => 235
  46. [filetime] => -1
  47. [ssl_verify_result] => 0
  48. [redirect_count] => 0
  49. [total_time] => 0.106437
  50. [namelookup_time] => 3.6E-5
  51. [connect_time] => 0.035309
  52. [pretransfer_time] => 0.035477
  53. [size_upload] => 528
  54. [size_download] => 74
  55. [speed_download] => 695
  56. [speed_upload] => 4960
  57. [download_content_length] => 74
  58. [upload_content_length] => 528
  59. [starttransfer_time] => 0.070569
  60. [redirect_time] => 0
  61. [redirect_url] =>
  62. [primary_ip] => xxx.xxx.xxx.xxx
  63. [certinfo] => Array
  64. (
  65. )
  66.  
  67. [primary_port] => 8332
  68. [local_ip] => xxx.xx.xxx.xxx
  69. [local_port] => 41040
  70. )
Add Comment
Please, Sign In to add comment