Show data from json

0

I need to recover the data POINTS and RODADA_ATUAL

The json link is - > link

This is the name of the team that wants to pull the dice: semtitulos

When you access this url all the team data appears, but I can not get the 2 values I need and print on the screen, I tried the following:

<?php

// EM file_get_contents

    $url = "https://api.cartolafc.globo.com/time/slug/semtitulos";

    $options = array(
        'http' => 
          array(
            'method' => 'GET', 
            'user_agent' => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)', 
            'timeout' => 1
            )
    );

    $context = stream_context_create($options);
    $response = file_get_contents($url, false, $context);
    $jogadores = json_decode($response, true);    


    $jogadores['atletas']['pontos'];
    $jogadores['atletas']['rodada_atual'];

     echo $jogadores;

?>

But do not aim for a result, but use the same scheme above to list the most heavily scaled players - > link and works normally. Can anyone help ???

    
asked by anonymous 16.06.2017 / 14:52

1 answer

0

It's only you to index the athletes since this information is coming at the root of json:

$pontos = $jogadores['pontos'];
$rodada = $jogadores['rodada_atual'];

JsonFormatter is a good site for you to better analyze the structure of JSON.

    
16.06.2017 / 15:03