Код: Выделить всё
$clientId = "";
$clientSecret = "";
$channelName = "";
$channelId = "";
$url = "https://id.twitch.tv/oauth2/token";
$data = array(
"client_id" => $clientId,
"client_secret" => $clientSecret,
"grant_type" => "client_credentials"
);
$options = array(
"http" => array(
"header" => "Content-type: application/x-www-form-urlencoded\r\n",
"method" => "POST",
"content" => http_build_query($data),
),
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$data = json_decode($response, true);
$accessToken = $data["access_token"];
// ...
Я пытался получить ключ трансляции Twitch через API, но безуспешно.
Подробнее здесь: https://stackoverflow.com/questions/759 ... stream-key