<?php
$ol = $_GET['tx'];
// API so'rovi uchun ma'lumotlar
$apiUrl = 'https://mohir.ai/api/v1/tts';
$apiKey = 'API_KEY'; // API kaliti o'zgartiring
// So'rovni tuzish
$data = [
'text' => $ol,
'model' => 'dilfuza',
'mood' => 'happy',
];
$options = [
'http' => [
'header' => "Content-type: application/json\r\n" .
"Authorization: $apiKey\r\n",
'method' => 'POST',
'content' => json_encode($data),
],
];
$context = stream_context_create($options);
$response = file_get_contents($apiUrl, false, $context);
// Natijani ekranga chiqarish
if ($response === FALSE) {
echo "Xatolik yuz berdi";
} else {
echo $response;
}
?>
Mohir.ai tts api
Api keyni mohir.ai saytidan olasizlar