Check if a streamer is streaming

hello , how can I check if a streamer is streaming or not ? I want to show a text if online and a text if online but how with the api ? :confused:

The Streams API is the correct way to check for online status.

ok

$url = 'https://api.twitch.tv/kraken/streams/rocketbeanstv';
$json = file_get_contents($url);
$data = json_decode($json, true);
$status = $data['status'];
if(isset($status)) {
	echo "$status";
}else{
	echo "no"; }

but why I get “no” ?? :frowning:

The stream object changes when the user is offline, you should look at both responses in your web browser.

the stream is online . same with offline streamer.

Compare:

https://api.twitch.tv/kraken/streams/rocketbeanstv
https://api.twitch.tv/kraken/streams/cobaltstreak

You would also ned $data[‘stream’][‘channel’][‘status’]

I’ll direct you to all the advice that was given to you on the other thread. All of those suggestions would help with understanding how to integrate and get the data you need. Also, it will keep you from being out of luck in 4 weeks when we require Client-ID. :slight_smile:

instead of

$data = json_decode($json, true);

?

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