I am wondering if its possible to use curl to getinfo from the bitcoin server thanks.

// init the resource
$ch = curl_init();

// set a single option...
$username = 'usernamefromconfig';
$pwd = 'passwordfromconfig';

    $ch, array( 
    CURLOPT_URL => "$username:[email protected]:8336",

$output = curl_exec($ch);
echo $output;

// free

1 Answer 1


You can use the command-line curl or any of the various JSON-RPC examples listed here.

In particular, you can use curl like this:

$ curl --user <username>:<password> --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;'

For PHP, you can use this library and do:

require_once 'jsonRPCClient.php';

$bitcoin = new jsonRPCClient('http://user:[email protected]:8332/');

echo "<pre>\n";
print_r($bitcoin->getinfo()); echo "\n";
echo "Received: ".$bitcoin->getreceivedbylabel("Your Address")."\n";
echo "</pre>";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.