require_once("jsonRPCClient.php");
$rpc_host="127.0.0.1";
$rpc_port=12345;
$rpc_user="some_rpc_user";
$rpc_pass="some_rpc_pass";
$client = new jsonRPCClient("http://".$rpc_user.":".$rpc_pass."@".$rpc_host.":".$rpc_port."/");
$raw_transaction=$client->getrawtransaction("de2824f54ccf5391bfc0c9b5a0a5e09214e4c045627a44c696bfb325f20c92ce", 1);
echo ""
;
print_r($raw_transaction);
echo "
";?>
Output:
Array
(
[hex] => 02000000010cd18acf5f2a854e93cc88058fc59c95c7b97ed2f255900bc0829a1f813d0b78010000006b483045022100ec82001cca4924e0f9b857153a0e6e07bcb5d657b090b870929014a14dbe6cf602207047b247b6c6b99f985406d9df184c81ff302b01c0dea1c396df1b8d0061713f0121037e69a13d14797dc3d9555cc75da616edb9c1a058876183fe0171f85c7ebf2672ffffffff02c35d462a010000001976a914e969fd5fb098999ab4df96429cf33aed4f33fe0788ac00ab9041000000001976a914ad5de988256a98eee955c77b1e92c7ff065ebf9988ac000000001b746578743a476f207769746820746865203c423e464c4f3c2f423e
[txid] => de2824f54ccf5391bfc0c9b5a0a5e09214e4c045627a44c696bfb325f20c92ce
[version] => 2
[locktime] => 0
[tx-comment] => text:Go with the FLO
[vin] => Array
(
[0] => Array
(
[txid] => 780b3d811f9a82c00b9055f2d27eb9c7959cc58f0588cc934e852a5fcf8ad10c
[vout] => 1
[scriptSig] => Array
(
[asm] => 3045022100ec82001cca4924e0f9b857153a0e6e07bcb5d657b090b870929014a14dbe6cf602207047b247b6c6b99f985406d9df184c81ff302b01c0dea1c396df1b8d0061713f01 037e69a13d14797dc3d9555cc75da616edb9c1a058876183fe0171f85c7ebf2672
[hex] => 483045022100ec82001cca4924e0f9b857153a0e6e07bcb5d657b090b870929014a14dbe6cf602207047b247b6c6b99f985406d9df184c81ff302b01c0dea1c396df1b8d0061713f0121037e69a13d14797dc3d9555cc75da616edb9c1a058876183fe0171f85c7ebf2672
)
[sequence] => 4294967295
)
)
[vout] => Array
(
[0] => Array
(
[value] => 50.04221891
[n] => 0
[scriptPubKey] => Array
(
[asm] => OP_DUP OP_HASH160 e969fd5fb098999ab4df96429cf33aed4f33fe07 OP_EQUALVERIFY OP_CHECKSIG
[hex] => 76a914e969fd5fb098999ab4df96429cf33aed4f33fe0788ac
[reqSigs] => 1
[type] => pubkeyhash
[addresses] => Array
(
[0] => FT7Hso1wQ7DpCtKNzGz3HNMHvA5KeKnLEd
)
)
)
[1] => Array
(
[value] => 11
[n] => 1
[scriptPubKey] => Array
(
[asm] => OP_DUP OP_HASH160 ad5de988256a98eee955c77b1e92c7ff065ebf99 OP_EQUALVERIFY OP_CHECKSIG
[hex] => 76a914ad5de988256a98eee955c77b1e92c7ff065ebf9988ac
[reqSigs] => 1
[type] => pubkeyhash
[addresses] => Array
(
[0] => FMdns8Aq7YNRxE43G1NeTzAggz38ed2Qy6
)
)
)
)
[blockhash] => 7e2f59f9ad863318538afc76c1ca553714e50f20b81db3ba650fb06ad149947a
[confirmations] => 2348
[time] => 1371831466
)
Works good and it's certainly easier to manage an array than having to parse it yourself. The only thing required is to strip text: and probably any html if you don't want anyone doing anything malicious with it (although you can't really do much in 120 characters).