File: /var/www/gurumedia_st_usr/data/www/gurumedia.store/frd-public/port-443/data.php
<?php
header('Content-Type: application/json');
/**
* ==============================
* Force POST only
* ==============================
*/
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
echo json_encode([
'success' => false,
'error' => 'Only POST method allowed',
'allowed' => ['POST']
]);
exit;
}
/**
* ==============================
* Read Raw Input
* ==============================
*/
$raw = file_get_contents('php://input');
if (!$raw) {
http_response_code(400);
echo json_encode([
'success' => false,
'error' => 'Empty request body'
]);
exit;
}
$data = json_decode($raw, true);
if (json_last_error() !== JSON_ERROR_NONE) {
http_response_code(400);
echo json_encode([
'success' => false,
'error' => 'Invalid JSON',
'json_error' => json_last_error_msg()
]);
exit;
}
/**
* ==============================
* Success Response
* ==============================
*/
echo json_encode([
'success' => true,
'message' => 'Request received successfully',
'debug' => [
'received_data' => $data,
'request_ip' => $_SERVER['REMOTE_ADDR'] ?? null,
'server_ip' => $_SERVER['SERVER_ADDR'] ?? null,
'time' => date('Y-m-d H:i:s')
]
], JSON_PRETTY_PRINT);