0
I need to recover the POINTS and RODADA_ATUAL data
The json link is --> https://api.cartolafc.globo.com/time/slug/semtitulos
That’s the name of the team I want to pull the dice on: semtitulos
When you access this url appears all the data of the team, but I can’t get the 2 values I need and print on the screen, I tried as follows:
<?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 no result objected, but I use the same scheme above to list the most scaled players --> https://api.cartolafc.globo.com/mercado/destaques and works normally. Someone can help ???
Removes the index
['atletas']
, leaves so:$jogadores['pontos'];
and$jogadores['rodada_atual'];
– JuniorNunes
Thank you Junior :)
– André Luiz Mardonis
I created an answer just to make it official!!
– JuniorNunes