Код: Выделить всё
// API URL
$api_url = "https://openapi.tuyaeu.com/v1.0/token?grant_type=1";
$timestamp = round(microtime(true) * 1000);
$headers = [
"grant_type: 1",
"client_id: xwnaaaaaaaaaaaaarae8y",
"secret: 0dfaaaaaaaaaaaaaaaaaaa37872d",
"t: $timestamp",
];
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo "cURL Error: " . curl_error($ch);
} else {
echo "Response: " . $response;
}
curl_close($ch);
?>
Есть ли у кого-нибудь опыт работы с tuya API и как получить токен доступа?
Подробнее здесь: https://stackoverflow.com/questions/792 ... n-with-php
Мобильная версия