What is wrong with my php code?
$data = @file_get_contents("https://api.twitch.tv/kraken/streams/36837650?client_id=xxxxxx&api_version=5");
$json = json_decode($data);
if (($json->stream === "NULL") || ($json->stream === "null")) {
echo "Stream is offline!";
}
else {
echo "Stream is online!";
}
I’m offline right now, but it still shows online!
When I do a var_dump($json->stream)
in the else
part it shows NULL
.