in this script what do I need to change to make it work for subscribers only?
> <?php
>
> $client_id = '';
>
> $client_secret = '';
>
> $redirect_uri = '';
>
> $broadcaster_id = '';
>
> if (isset($_GET['code']) && $_GET['code']) {
>
> $token_url = "https://id.twitch.tv/oauth2/token";
>
> $data = array(
>
> 'client_id' => $client_id,
>
> 'client_secret' => $client_secret,
>
> 'grant_type' => 'authorization_code',
>
> 'redirect_uri' => $redirect_uri,
>
> 'code' => $_GET['code']
>
> );
>
> $curl = curl_init($token_url);
>
> curl_setopt($curl, CURLOPT_POST, true);
>
> curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
>
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
>
> curl_setopt($curl, CURLOPT_TIMEOUT, 1000);
>
> $result = curl_exec($curl);
>
> $i = curl_getinfo($curl);
>
> curl_close($curl);
>
> if ($i['http_code'] == 200) {
>
> $result = json_decode($result, true);
>
> $curl = curl_init('https://api.twitch.tv/helix/subscriptions?broadcaster_id=' . $broadcaster_id . '&user_id' . $user_id);
>
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
>
> curl_setopt($curl, CURLOPT_HTTPHEADER, array(
>
> 'Client-ID: ' . $client_id,
>
> 'Authorization: Bearer ' . $broadcasters_token
>
> ));
>
> curl_setopt($curl, CURLOPT_TIMEOUT, 1000);
>
> $subdata = curl_exec($curl);
>
> $i = curl_getinfo($curl);
>
> curl_close($curl);
>
> if ($i['http_code'] == 200) {
>
> $user = json_decode($user);
>
> echo '<p>Thanks ' . $user->data[0]->display_name . ' <3</p>';
>
> } else {
>
> echo '<p>An error occured, please <a href="/index.php">click here and try again</a></p>';
>
> }
>
> } else {
>
> echo '<p>An error occured, please <a href="/index.php">click here and try again</a></p>';
>
> }
>
> } else {
>
> $auth_url = 'https://api.twitch.tv/kraken/oauth2/authorize?response_type=code';
>
> $auth_url .= '&client_id=' . $client_id;
>
> $auth_url .= '&redirect_uri=' . $redirect_uri;
>
> $auth_url .= '&scope=user_read';
>
> $auth_url .= '&force_verify=true';
>
> echo '<a href="' . $auth_url . '">Please Click this Link to Authenticate with Twitch</a>';
>
> }