I’m attempting to automate updating stream title and game because my streamer partner is struggling with remembering to do those. This is my first stab at doing it in PHP - here’s my code (minus extraneous var_dump bits):
$URD = curl_init();
$URDarray = array(
'game_id'=>'32982',
'title'=>'There be chaos up in here',
'broadcaster_language'=>'en'
);
$URDinput = json_encode($URDarray);
curl_setopt($URD, CURLOPT_URL, "https://api.twitch.tv/helix/channels?broadcaster_id=501071947");
curl_setopt($URD, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($URD, CURLOPT_HTTPHEADER, array(
'Content-type: application/json',
'Authorization: Bearer '.$authtoken,
'Client-ID: '.$clientid,
));
curl_setopt($URD, CURLOPT_POST,true);
curl_setopt($URD, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($UCR, CURLOPT_POSTFIELDS,$URDinput);
$URRdata = json_decode(curl_exec($URD),true);
curl_close($URD);
The response I’m getting is:
array(3) {
[“error”]=>
string(11) “Bad Request”
[“status”]=>
int(400)
[“message”]=>
string(61) “request must contain at least 1 channel property for updating”
}
Can some kind person please help me figure out what I’ve done wrong - the auth is working, the channel scope is good, so I’m sure there’s just some glaring errors in the way I’ve attempted to do the CURL patch stuff - the documentation is really really unhelpful for novice programmers!