Get informations when stream is offline

Hello,

How can i get informations like profil picture when stream is offline ?

$channelName = ******;
$json_array = json_decode(file_get_contents(‘https://api.twitch.tv/kraken/streams/’.strtolower($channelName)), true);

	        if ($json_array['stream'] != null) {

		$currentGame = $json_array['stream']['channel']['game'];
		$channelTitle = $json_array['stream']['channel']['display_name'];
		$streamTitle = $json_array['stream']['channel']['status'];
		$viewers = $json_array['stream']['viewers'];
        $logo = $json_array['stream']['channel']['logo'];
       
		}

It’s work when the stream is online,but not when stream is offline

I have search and the stream key is always null when stream is offline.So what can i do?

Thank’s for your helps,

Edit : Solve

Use https://api.twitch.tv/kraken/channels/test_channel instead

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.