Thank you pointing out the cURL thing, I wasn’t aware that was required when Client-ID kicks in, hopefully i’ll figure out how to rewrite that.
As for the current code, I’ve been experimenting, thinking I’ve been reading it wrong. When I try: $team = $data['_links']['self']; I actually get the expected result, but when I try: $team = $data['teams']['display_name']; I get nothing and it just returns API error. So I’ve been experimenting a bit with: $data = json_decode(@file_get_contents('https://api.twitch.tv/kraken/channels/' . TWITCHCHANNEL . "/teams"), true); trying things like /channels/ or /teams/ or even /channels/lirik/teams, (thanks @tournymasterbotCurse), to see if it’s that url that is wrong, so far no luck there.
Updated code so far:
// Current active team on Twitch
function twitchTeam() {
$data = json_decode(@file_get_contents('https://api.twitch.tv/kraken/channels/' . TWITCHCHANNEL . "/teams"), true);
$team = $data['teams']['display_name'];
if($team != null)
{
echo $team;
}
else
{
echo "API error";
}
}