Search the Community
Showing results for tags 'bitcoin'.
-
I am trying to using this API. https://www.blocktrail.com/api/docs I can retrieve the first layer value using this. $global_trans_id = $client->transaction($post_transid); $api_transaction_id = $global_trans_id['hash']; echo $api_transaction_id; As you see "hash" is the first layer below. But what if I want to retrieve the second layer such as a value from "Inputs" or "Outputs" like "$global_trans_id['address'];". How would that look? { "hash": "c326105f7fbfa4e8fe971569ef8858f47ee7e4aa5e8e7c458be8002be3d86aad", "first_seen_at": "2014-03-11T08:27:57+0000", "last_seen_at": "2014-03-11T08:27:57+0000", "block_height": 290000, "block_time": "2014-03-11T08:27:57+0000", "block_hash": "0000000000000000fa0b2badd05db0178623ebf8dd081fe7eb874c26e27d0b3b", "confirmations": 31130, "is_coinbase": false, "estimated_value": 70000000, "total_input_value": 70070000, "total_output_value": 70030000, "total_fee": 40000, "estimated_change": 30000, "estimated_change_address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "high_priority": false, "enough_fee": true, "contains_dust": false, "inputs": [ { "index": 0, "output_hash": "d283ab6edd394b8a69d6943ea3a29a679d92176b112b1f69ffb9b70cf27dec5a", "output_index": 2769, "value": 2730000, "address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "type": "pubkeyhash", "multisig": null, "script_signature": "0x49 0x3046022100bb3d102afd0d57be618aeaa7432bc038dea928bec0af6b8cba37c7ec85701e3d022100c467073956b385f08fbfbc2e130d8f76deb7c5436ba245afca4678200b127c2001 0x21 0x02aa6584518e528be497be65fba84913b7d0cb55158f4e7922298923286a7f6156" }, { "index": 1, "output_hash": "b350de75f9c27b457fa6cefb7072af8aa94de53ccedff4ec06ce885d63645e1d", "output_index": 2764, "value": 2740000, "address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "type": "pubkeyhash", "multisig": null, "script_signature": "0x48 0x3045022059c6cc77c0a7c3a3a1ab0678690178750f2b5e442dc6f9331835be4cdb087cc00221008fca79860ab8f15acba61522b4f8482909cadfdf79dca7790efabf71c7c12d3701 0x21 0x02aa6584518e528be497be65fba84913b7d0cb55158f4e7922298923286a7f6156" }, { "index": 2, "output_hash": "fa3f040de013ddbe4a5746c89d32de2cac147845682e7d26119fd686a57e0b65", "output_index": 2549, "value": 2930000, "address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "type": "pubkeyhash", "multisig": null, "script_signature": "0x47 0x304402207266d8c69d2c28e4050a90f48209768554e1470999a2259b000fd3c096edc39f02207b7f6a6b7ca7952249a1a1f3064e6a3f573fcd6700084e2fe71ce8f3d3f2be8301 0x21 0x02aa6584518e528be497be65fba84913b7d0cb55158f4e7922298923286a7f6156" }, { /* ... */ } ], "outputs": [ { "index": 0, "value": 70000000, "address": "1JSywyhFSvCC4NGALvKoyX5xng86QaigAN", "type": "pubkeyhash", "multisig": null, "script": "DUP HASH160 0x14 0xbf641337e3ab4eaae788a72bafedb965749882b2 EQUALVERIFY CHECKSIG", "script_hex": "76a914bf641337e3ab4eaae788a72bafedb965749882b288ac", "spent_hash": "71acf863d37d9d18524607e3dd68128b91ddc43dfe32f620ec124ceff3bb3295", "spent_index": 34 }, { "index": 1, "value": 30000, "address": "19M1EraiuAvZp8ZV7QJHH2LVkYm8ECufCJ", "type": "pubkeyhash", "multisig": null, "script": "DUP HASH160 0x14 0x5b8986608535c96923769138ad5be236a091b791 EQUALVERIFY CHECKSIG", "script_hex": "76a9145b8986608535c96923769138ad5be236a091b79188ac", "spent_hash": "400f77fff18e24d1a770c0e1ca85434ca5e4cd0f6e1489e5849256cc71f9ec0a", "spent_index": 2 }, { /* ... */ } ] }
-
I am using this API https://github.com/blocktrail/blocktrail-sdk-php. I am suppose to add this to top of my directory where I want to initialize the API. require 'vendor/autoload.php'; use Blocktrail\SDK\BlocktrailSDK; But the second line gives me an error. use Blocktrail\SDK\BlocktrailSDK; Parse error: syntax error, unexpected 'use' (T_USE) in C:\xampp\htdocs\site\templates\header.php on line 12 Is the "use" a correct syntax for php? Why is it giving me an error?
-
I'm using this bitcoin price ticker that is using Mt.Gox but they're no longer in service unfortunately. I'm trying to replace Mt.Gox with blockchain or something similar. Can anyone please help me fix this? I tried https://www.bitstamp.net/api/ticker/ and https://blockchain.info/ticker but neither are working. I'm doing this for my site http://www.bitcoinvalues.net. Thanks <?php //first fetch the current rate from MtGox $ch = curl_init('https://mtgox.com/api/0/data/ticker.php'); curl_setopt($ch, CURLOPT_REFERER, 'Mozilla/5.0 (compatible; MtGox PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); curl_setopt($ch, CURLOPT_USERAGENT, "CakeScript/0.1"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $mtgoxjson = curl_exec($ch); curl_close($ch); //decode from an object to array $output_mtgox = json_decode($mtgoxjson); $output_mtgox_1 = get_object_vars($output_mtgox); $mtgox_array = get_object_vars($output_mtgox_1['ticker']); ?> <br/> <br/> Last: <?php echo $mtgox_array['last']; ?><br/> High: <?php echo $mtgox_array['high']; ?><br/> Low: <?php echo $mtgox_array['low']; ?><br/> Avg: <?php echo $mtgox_array['avg']; ?><br/> Vol: <?php echo $mtgox_array['vol']; ?><br/>
-
if($balance >= $cashout){ $mysqli->query("UPDATE balances SET balance=balance-$balance WHERE email='$email'"); $balanceQ = $mysqli->query("SELECT balance FROM balances WHERE email='$email'"); //we check again to prevent race attacks if($balanceQ->fetch_row() >= 0){ $url = "https://inputs.io/api?key=$apiKey&action=send&address=&amount=¬e=&pin=$apiPin" . urlencode($cashoutMessage . " | MyFaucet Powered") . "&address=" . urlencode($email) . "&amount=" . ($balance / 100000000); $response = file_get_contents($url); if($response[0] == "["){ //success echo "<div class='alert alert-success'>Successful cashout to $email - enjoy!</div>"; } else { echo "<div class='alert alert-error'>An error has occured - $response</div>"; if($response == "NO_BALANCE"){ echo "<div class='alert alert-error'>The site does not have enough coins to pay out!</div>"; $mysqli->query("UPDATE balances SET balance=balance+$balance WHERE email='$email'"); Im having problems when people go cashout and they get error page i think the problem is $url but i dont know if you want to find out the api go here https://inputs.io/api and head to send transactions so from there i dont know what else to do.