fork download
  1. <?php
  2. $url = "http://e...content-available-to-author-only...s.com: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 erro hai.........r: " . curl_error($ch);
  30. error_log("cURL error (" . curl_errno($ch) . "): " . curl_error($ch));
  31. }
  32.  
  33. // Close cURL
  34.  
  35. // Print response
  36. echo $response;
  37. ?>
  38.  
Success #stdin #stdout #stderr 0.03s 26424KB
stdin
Standard input is empty
stdout
 cURL erro hai.........r: Could not resolve host: ec2-54-85-96-159.compute-1.amazonaws.com
stderr
cURL error (6): Could not resolve host: ec2-54-85-96-159.compute-1.amazonaws.com