vendredi 28 mai 2021

PHP Array get value within if value is found

As the title says im trying to get addresses with a certain search query. Im trying to get the addresses if n = a specific number, in this example 0

I decoded the json to an php array using json_decode($json, true)

{
    "result": {
        "txid": "40ca93b1c36355cf53817c233e1dcad8658ae7640754666c6618f7fcc46d78fe",
        "hash": "7bf98122b6fc6270e025eb7a54a0002160ea0a70234c5ddbf83829fa6194502b",
        "vout": [
            {
                "value": 6.73707231,
                "n": 0,
                "scriptPubKey": {
                    "asm": "OP_DUP OP_HASH160 536ffa992491508dca0354e52f32a3a7a679a53a OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914536ffa992491508dca0354e52f32a3a7a679a53a88ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash",
                    "addresses": [
                        "18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX"
                    ]
                }
            },
            {
                "value": 0.00000000,
                "n": 1,
                "scriptPubKey": {
                    "asm": "OP_RETURN 52534b424c4f434b3a2fa0aeae5b032973f7e4646182b15e99e85e6be4c6b0c830a207f21c0032ca3c",
                    "hex": "6a2952534b424c4f434b3a2fa0aeae5b032973f7e4646182b15e99e85e6be4c6b0c830a207f21c0032ca3c",
                    "type": "pubkeyhash"
            "addresses": [
                        "545545553454354"
                    ]
                }
            },
            {
                "value": 0.00000000,
                "n": 2,
                "scriptPubKey": {
                    "asm": "OP_RETURN b9e11b6d3600c5e9411b60ef0150a4eb5a9e18c6e9fc43390ef6eb3357a58f992a82c0a7",
                    "hex": "6a24b9e11b6d3600c5e9411b60ef0150a4eb5a9e18c6e9fc43390ef6eb3357a58f992a82c0a7",
                    "type": "pubkeyhash"
            "addresses": [
                        "asdas5d6as1dsa1sd15asd156"
                    ]
                }
            }
            }
        ],
        "blockhash": "000000000000000000038e4342bab438ad277824e17d39cf39a44fc5aa419ff4",
        "confirmations": 3029
    },
    "error": null,
    "id": "curltest"
}

Aucun commentaire:

Enregistrer un commentaire