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 );
            }

    ?>

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>";
    }
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

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