Not able to pull clips?

ive been trying to setup a simple page to access top clips, im stuck on this…

ive been trying to follow this reference / clips

 <?php
 $clipsApi = 'https://api.twitch.tv/kraken/clips/top?channel=MYTWITCHNAME&period=month&trending=true&limit=1';
 $clientId = 'MYCLIENTID';
 $ch = curl_init();
 curl_setopt_array($ch, array(
 CURLOPT_HTTPHEADER => array(
 'Client-ID: ' . $clientId
),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $clipsApi 
 ));
 $response = curl_exec($ch);
 echo curl_error($ch);
 curl_close($ch);

 $json = json_decode($response, true);
 echo $json['name'];
 ?>

As the example request in the docs shows, you have to add the Accept header to use v5. otherwise it defaults to v3

Accept: application/vnd.twitchtv.v5+json

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