HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/xampp/htdocs/dropfile/php/uploads/postTest2.php
<?php
// Get the JSON data sent from Postman
$json = file_get_contents('php://input');

// Decode JSON to PHP array
$data = json_decode($json, true);

// Process the data
if ($data !== null) {
    // Access the JSON values
    // Example: Access the 'name' field from JSON
    $name = $data['name'];
    $age = $data['age'];
    // Respond back with a message (optional)
    echo json_encode(array('message' => "Hello, $age! $name! JSON received successfully."));
} else {
    // Respond with an error message if JSON data is invalid
    echo json_encode(array('message' => 'Invalid JSON data'));
}
?>