You’re not sending a Client-ID, which is required to use the API. https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843#.ws4h7qtyp
I wouldn’t recommend using file_get_contents
and instead use cURL. There are many threads here on the forum showing how to use cURL and how to detect if someone is online/offline.
hi ! I wrote this script but I get nothing after “bio” … but why ?
<?php
$url = 'https://api.twitch.tv/kraken/users/gronkh';
$json = file_get_contents($url);
$data = json_decode($json, true);
$bio = $data['bio'];
echo "bio: $bio";
?>
whats wrong ?
Not sure why, but I grabbed this code from another thread which is now close and it doesn’t matter with which accounts (even live ones) they all appear as offline. I just copy/paste straight into PHP, please help.
Is there something else that needs to be done in order to work properly?
$live = array();
$channels = array("themittanidotcom", "djyumene", "mym_alkapone", "Rightrevgoldstein", "daopa", "streamerhouse", "cabochardlol", "moanygamer", "bajheera", "lelaaone", "Old_Bearded_Gamer");
// T…
Hi friends.
I’m on page 20 output channels, their headers.
The page is loaded for a long time to solve the problem?
Example:Check stream status
<?php
$start = microtime(true);
$channel = "versuta";
$json_file = @file_get_contents("https://api.twitch.tv/kraken/streams/{$channel}", 0, null, null);
$json_array = json_decode($json_file, true);
if ($json_array['stream'] == null)
{echo 'offline' } else { echo 'online' }
$time = microtime(true) - $start;
printf('Time of loading %.4F …