PHP check to see if stream is live not working

Can anyone point me in the right direction? I know I’m close but this code isn’t working yet.

EDIT: I figured out what’s wrong (I think), but need helping implementing it. Oauth is missing, I have no idea on how to include this here though or how to generate the Oauth code.

// Options

$channelName = 'mavemixes';

$baseURL = '';
$url = $baseURL . 'streams?user_login=' . $channelName;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Client-ID: ' . $clientID ]);
$json = curl_exec($ch);

$data = json_decode($json);
if(count($data->data)) {
	echo '<h1>We're live!</h1>';
	echo '<div id="twitch-embed"></div>';
	echo '<h3>Currently not streaming. <br>Follow MaveMixes on Twitch and get instantly notified when we are live.</h3>';
  new Twitch.Embed("twitch-embed", {
    width: 1000,
    height: 600,
    channel: "mavemixes",
    layout: "video",

Thanks in advance!

Documentation is here

You probably want to be generating storing and using until expires an app access token

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