<?php
header('Content-Type: application/json');

// Assuming you have the user ID from the request
$userId = $_GET['user_id'] ?? '';

// Path to your JSON file (adjust as needed)
$jsonFile = '../data.json';

// Read the JSON file
$jsonData = file_exists($jsonFile) ? json_decode(file_get_contents($jsonFile), true) : [];

// Find the user's data
$userData = $jsonData[$userId] ?? [];

// Prepare the response
$response = [
    'inflows' => $userData['user_inflows'] ?? []
];

echo json_encode($response);
?>