New API rules breaking old script, help

Your query string and the url you were sending the post request to were just incorrect.

$ch = curl_init("https://id.twitch.tv/oauth2/token");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$fields = array(
    'client_id' => 'p8li1rfpjyvhm1626h00ame4ccfh22',
    'client_secret' => 'xxxxxxxxxxxxxxxxx',
    'grant_type' => 'client_credentials'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$data = curl_exec($ch);


print_r($data); 
$info = curl_getinfo($ch); 

echo '<pre>';
print_r($info);
echo '</pre>';
1 Like