HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux vmi3050980 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64
User: gurumedia_st_usr (1012)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/gurumedia_st_usr/data/www/gurumedia.store/frd-api/frdapi-port443.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;
}


function receiveData(): array
{
    $contentType = $_SERVER['CONTENT_TYPE'] ?? '';

    if (stripos($contentType, 'application/json') !== false) {
        $raw = file_get_contents('php://input');
        $data = json_decode($raw, true);
        return is_array($data) ? $data : [];
    }

    return $_POST;
}

// Usage
$data = receiveData();



/**
 * ==============================
 * 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);