-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathserver.php
More file actions
28 lines (23 loc) · 859 Bytes
/
server.php
File metadata and controls
28 lines (23 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
header("Content-Type: application/json");
if (!isset($_POST['q']) || trim($_POST['q']) === '') {
echo json_encode(["status" => false, "message" => "Pertanyaan kosong"]);
exit;
}
$query = $_POST['q'];
$sessionId = "5373828261819"; // ganti dengan sessionId
$apiKey = "GetsuzoCp7";
$url = "https://api.neoxr.eu/api/gpt4-session?q=" . urlencode($query) .
"&session=" . urlencode($sessionId) .
"&apikey=" . urlencode($apiKey);
$response = file_get_contents($url);
if ($response === false) {
echo json_encode(["status" => false, "message" => "Gagal menghubungi API"]);
exit;
}
$data = json_decode($response, true);
if (isset($data['data']['message'])) {
echo json_encode(["status" => true, "message" => $data['data']['message']]);
} else {
echo json_encode(["status" => false, "message" => "Tidak ada jawaban"]);
}