I working on a php script that is useing cURL returning a JSON object.
It outputting like this
stdClass Object
(
[hash160] => e8bb296352b4926574363bba6603703589d12d25
[address] => 1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW
[n_tx] => 3
[n_unredeemed] => 3
[total_received] => 3000000
[total_sent] => 0
[final_balance] => 3000000
[txs] => Array
(
[0] => stdClass Object
(
[hash] => 3a6ee1f05b3eb402878f1ac28efb056caf8cea584181bd931024cf7ce1dfdb11
[ver] => 1
[vin_sz] => 1
[vout_sz] => 2
[size] => 258
[relayed_by] => 127.0.0.1
[tx_index] => 28108192
[result] => 0
[time] => 1349051111
[block_height] => 201313
[inputs] => Array
(
[0] => stdClass Object
(
[prev_out] => stdClass Object
(
[type] => 0
[addr] => 1GHYfp7X81X8pXBpmQZwFJcXCsoCAESNag
[value] => 39000000
[tx_index] => 28107939
[n] => 1
)
) ) [out] => Array ( [0] => stdClass Object ( [addr] => 1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW [value] => 1000000 [type] => 0 ) [1] => stdClass Object ( [addr] => 1GHYfp7X81X8pXBpmQZwFJcXCsoCAESNag [value] => 37950000 [type] => 0 ) ) )[/QUOTE]
The only important data in there is the [time] and [Value]
my script so far
<?php
$address = '1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW';
$address_info = get_address_info($address);
echo '<pre>';
print_r($address_info);
echo '</pre>';
function get_address_info($address, $debug = false) { $url = 'http://blockchain.info/address/' . $address . '?format=json'; if ($debug) { echo 'Fetching URL: '.$url.'<br/>'; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $response = curl_exec($ch); curl_close($ch); if ($debug) { echo '<pre>Curl Response: '; print_r($response); echo '</pre>'; } return json_decode($response); echo '<pre>Curl Response: '; print_r($address_info); echo '</pre>'; } ?>[/QUOTE]
Im pretty new to php and having a hard time finding examples working with JSON objects.
Trying to first just display only the time and value in presentable formatting.
eventually Im looking to take these [time] and [vaule] and enter them into an sql database. Checking the timestamps and increasing the balance only on new vaules transactions.