I am trying to build a script that will give me the amount a user has sent to a given bitcoin address. Currently this data is in JSON format.
How can I use this JSON data to know the amount that was LAST sent to a given address?
For the moment I have as a return of a submitted form:
$userIDsent = $_POST['userID'];
$adrsBTCsent = $_POST['adrsBTC'];
$bcInfo = json_decode(file_get_contents("https://blockchain.info/address/". $adrsBTCsent ."?format=json"), true);
$nombre_de_transac = $bcInfo["n_tx"];
$valeur_en_satochi = $bcInfo["total_received"];
If ($nombre_de_transac > 1){
/* more then 1 transaction for that BTC adds. I need to know what is the amount last sent and NOT the total amount used on that address */
} else {
/* 1 transaction this address is new so let's get the amount of BTC sent */
echo "The user ".$userIDsent." has sent ". $valeur_en_satochi . "uBTC";
echo "bra, bla, bla lets continue";
}
Thank you for your help.