fork download
  1. <?php
  2. $url = "http://54.85.96.159:5001/tokens/allocation"; // Replace with your target API URL
  3.  
  4. $data = [
  5. "email" => "dilipkumar.gupta@reseit.in",
  6. "cost" => 5
  7. ];
  8.  
  9. // Convert data to JSON
  10. $jsonData = json_encode($data);
  11.  
  12. // Initialize cURL
  13. $ch = curl_init($url);
  14.  
  15. // Set cURL options
  16. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  17. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  18. "Content-Type: application/json",
  19. "Accept: application/json"
  20. ]);
  21. curl_setopt($ch, CURLOPT_POST, true);
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
  23.  
  24. // Execute request
  25. $response = curl_exec($ch);
  26.  
  27. // Check for errors
  28. if (curl_errno($ch)) {
  29. echo "cURL error: " . curl_error($ch);
  30. }
  31.  
  32. // Close cURL
  33.  
  34. // Print response
  35. echo $response;
  36. ?>
Success #stdin #stdout 0.03s 25456KB
stdin
Standard input is empty
stdout
cURL error: