Need help with "Accept: application/vnd.twitchtv.v5+json"


#1

Hello guys. I have a website that lists certain streams when they are online.
Recently it stopped working

As I understand after reading migration guide I need to put Accept: application/vnd.twitchtv.v5+json somewhere in the code.

So I have the following:

$twitch_url = "https://api.twitch.tv/kraken/streams?channel=". $twitch_channels ."";
                    $clientId = 'xxxxxxxxxxxxxxxxxxxxxxxx';
                    
		$curl = curl_init();
                    curl_setopt_array($curl, array(
                    CURLOPT_HTTPHEADER => array(

   'Client-ID: ' . $clientId
),
		CURLOPT_RETURNTRANSFER => 1,
		CURLOPT_TIMEOUT => 30,
		CURLOPT_URL => $twitch_url));

		$data = curl_exec($curl);

		curl_close($curl);

Could you please help me to put “Accept: application/vnd.twitchtv.v5+json” properly


#2
curl_setopt_array($curl, array(
CURLOPT_HTTPHEADER => array(
   'Client-ID: ' . $clientId,
   'Accept: application/vnd.twitchtv.v5+json'
),

It’s a header so should be sent as a header like you do with the clientID


#3

Thx a lot Barry!

Unfortunately it didn’t help. I have streamers’ usernames stored in databes, maybe I should change usernames to IDs?


#4

Yes v5 uses ID’s not usernames


#5

Hey @RealPaleMan

I am also facing same issue.
Would you please share your website url.


#6

I provided the solution.

All the steps needed to migrate are documented here:


#7

There is no point in sharing my website url since nothing is working there (I have no time and no skills to make it work). But if your site is using wordpress I can recommend “Twitch TV Easy Embed” plugin, it works