PHP [SOLVED]: why do I get only 3 return values by using a json link:

PHP [SOLVED]: why do I get only 3 return values by using a json link:

Home Forums Scripting PHP Tutorials PHP [SOLVED]: why do I get only 3 return values by using a json link:

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #245538

    Cloudy Point
    Keymaster

    QuestionQuestion

    there should be many more return values?

    print_r($data);
    

    shows that there is much more to be displayed.
    Thanks for any hints,

    Stefan

    <?php 
    $data = json_decode(file_get_contents('https://bittrex.com/api/v1.1/public/getorderbook?market=BTC-DOGE&type=sell'),TRUE);
    //print_r($data);
    $ncount = COUNT( $data );
    for($i=0;$i<$ncount;$i++){
    echo $data['result'][$i]['Quantity'] .'<br />';
    }
    ?>
    

    #245539

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    $ncount should be the count() of $data['result'];

    Try this:

    <?php 
    $data = json_decode(file_get_contents('https://bittrex.com/api/v1.1/public/getorderbook?market=BTC-DOGE&type=sell'),TRUE);
    
    $ncount = count($data['result']);
    for($i=0;$i<$ncount;$i++){
        echo $data['result'][$i]['Quantity'] .'<br />';
    }
    ?>
    

    Source: https://stackoverflow.com/questions/48025571/why-do-i-get-only-3-return-values-by-using-a-json-link
    Author: MCMXCII
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.