daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Apr 21st, 2018 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /**
  4.  * Created by PhpStorm.
  5.  * User: PauleBert
  6.  * Date: 21.04.18
  7.  * Time: 19:19
  8.  */
  9. class HttpPOSTRequest
  10. {
  11.     function makeHttpRequest($receiver, $amount){
  12.  
  13.         User=bitcoind Pass=bitcoin
  14.  
  15.         $user = 'bitcoind';
  16.         $pw = 'bitcoin';
  17.  
  18.         echo 'hi';
  19.         $postData = array(
  20.             'method' => "",
  21.             'params' => array($receiver,$amount,'Kommentar', "nix"),
  22.             'id' => 'Keine Ahnung Timestamp???',
  23.             'jsronrpc' => '1.0',
  24.             'content' => 'With<b>exciting</b>content...'
  25.  
  26.         );
  27.         $context = stream_context_create(array(
  28.             'http' => array(
  29.                 'method' => 'POST',
  30.                 'header' => array("Content-Type: application/jsonr\r\n",
  31.                         'Authorization: Basic '. base64_encode($user.':'.$pw)),
  32.                 'content' => json_encode($postData)
  33.             )
  34.         ));
  35.  
  36.         $result = file_get_contents('127.0.0.1:8332', false, $context);
  37.  
  38.         if ($result === FALSE) {
  39.             /* kp */
  40.         }
  41.         $resultData = json_decode($result, TRUE);
  42.         $error = $resultData->{'error'};
  43.         echo $error;
  44.         //dump var:
  45.         var_dump($result);
  46.     }
  47.  
  48.  
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top