how loop through a JSON Array of bitcoin transaction data

0 votes

My code is:

$requesturl='https://blockchain.info/tx-index/1fda663d2584425f192eae045d3809950883ebe50f2222f98ef7d31f414f3f96?format=json';
$ch=curl_init($requesturl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$cexecute=curl_exec($ch);
curl_close($ch);
$result = json_decode($cexecute,true);
// to get the first i use 
echo $result['out'][0]['addr'];
to get the second I use
echo $result['out'][0]['addr']; 

Now my requirement is to look through the array using for each but its throwing error:

foreach ($result['out'] as $adressee) {
   echo $adressee.'<br>';
}
Sep 21, 2018 in Blockchain by digger
• 26,740 points
738 views

1 answer to this question.

0 votes
for($i=0; $i<count($result['out']); $i++) {

   echo $result['out'][$i]["addr"].'<br>';
  }

Some Sample codes in PHP manual helped me come up with this solution

answered Sep 21, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

0 votes
1 answer

In hyperledger, how many number of ordering node can take up a transaction?

There are two types to implement ordering: 1. ...READ MORE

answered Jun 25, 2018 in Blockchain by Omkar
• 69,220 points

edited Jun 28, 2018 by Omkar 1,261 views
0 votes
1 answer

How to set the hex-encoded data field in a Web3j Ethereum transaction?

You can use the "data" field of ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 69,220 points
3,005 views
0 votes
0 answers

How to get AUD price of bitcoin at a particular date

I am trying to find out how ...READ MORE

Mar 1, 2022 in Blockchain by Soham
• 9,710 points
444 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,428 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,923 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
0 votes
1 answer

How to write a program to get details of ERC tokens?

You can use Javascript with the Metamask ...READ MORE

answered Jul 13, 2018 in Blockchain by slayer
• 29,370 points
943 views
0 votes
2 answers

How is a transaction public key related to original public?

The details like account balance, nonce etc., ...READ MORE

answered Jul 24, 2018 in Blockchain by digger
• 26,740 points
710 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP