<?php
$url = "http://54.85.96.159:5001/tokens/allocation"; // Ensure the URL includes the protocol

$data = [
    "email" => "dilipkumar.gupta@reseit.in",
    "cost" => 5
];

// Convert data to JSON
$jsonData = json_encode($data);

// Initialize cURL
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "Accept: application/json"
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // Optional: Increase timeout

// Execute request
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch)) {
    echo "cURL erro hai.........r: " . curl_error($ch);
    error_log("cURL error (" . curl_errno($ch) . "): " . curl_error($ch));
}

// Close cURL
curl_close($ch);

// Print response
echo $response;
?>
