I’ve make this but don’t work.
$cho = curl_init();
curl_setopt($cho, CURLOPT_URL, 'https://api.twitch.tv/kraken/oauth2/token');
curl_setopt($cho, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cho, CURLOPT_POST, 1);
curl_setopt($cho, CURLOPT_POSTFIELDS, http_build_query([
'client_id' => 'c533u8ntdp29h42xxzwfe0pf5v66dm',
'client_secret' => 'REMOVED',
'grant_type' => 'client_credentials',
'code' => $_GET['code']
]));
$output = curl_exec($cho);
curl_close($cho);
$oauth = json_decode($output, true);
// start call API
$all_channels = [];
foreach($channels as $chans){
if (count($chans) > 0) {
$callAPI = implode('&user_login=', $chans);
$url="https://api.twitch.tv/helix/streams?user_login=" . $callAPI;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' $oauth ''
'Client-ID: c533u8ntdp29h42xxzwfe0pf5v66dm'
));
$result = curl_exec($ch);
$i = curl_getinfo($ch);
curl_close($ch);