1

i am trying to get this code to return all the coin names in list format however the following code is not producing a response. is there anything i can change for this to return all the CoinNames from the array in the url

 <?php
 $url = "https://min-api.cryptocompare.com/data/all/coinlist";
 $data = json_decode(file_get_contents($url), true);
 foreach($data as $item){
 $coinNames = array_column( $item['Data'], 'CoinName' );
 echo implode( ", ", $coinNames );
 }
 ?>
asked Mar 20, 2019 at 10:01

1 Answer 1

1

Here you go my dude

 $url = file_get_contents("https://min-api.cryptocompare.com/data/all/coinlist");
 $data = json_decode($url,true);
 foreach ($data['Data'] as $coinNames) {
 echo $coinNames['CoinName'] . "<br>";
 }
answered Mar 20, 2019 at 10:08
Sign up to request clarification or add additional context in comments.

1 Comment

@LewisDay don't forget to accept the answer if it was useful :)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.