With JSON how do I know the amount that was LAST sent to a given address? 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 &gt; 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.
You can also use the filter GET parameter to ensure that the first transaction is one where the address receives bitcoins and not one where the address spent bitcoins and the limit parameter to only fetch one transaction (the latest).

For example https://blockchain.info/address/1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp?filter=2&amp;limit=1&amp;format=json

To get the amount sent, you'll have to filter outputs to get the one sending BTC to the address you're interested in and then get the value field (divide by 100,000,000 to get the amount in BTC).

If you are doing this as a way to get notified of incoming payements, I highly recommend you to use the Receive Payments API as it is dedicated to this use case.