fork download
  1. <?php
  2. $url = "http://54.85.96.159:5001/tokens/allocation";
  3. $data = [
  4. "email" => "dilipkumar.gupta@reseit.in",
  5. "cost" => 5
  6. ];
  7.  
  8. $jsonData = json_encode($data);
  9. $options = [
  10. 'http' => [
  11. 'method' => 'POST',
  12. 'header' => 'Content-type: application/json',
  13. 'content' => $jsonData,
  14. 'timeout' => 60
  15. ]
  16. ];
  17.  
  18. $context = stream_context_create($options);
  19. $response = file_get_contents($url, false, $context);
  20.  
  21. if ($response === FALSE) {
  22. error_log("Request failed");
  23. } else {
  24. error_log("Response received: $response");
  25. }
  26. echo $response;
  27. ?>
Success #stdin #stdout #stderr 0.03s 25712KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  file_get_contents(http://54.85.96.159:5001/tokens/allocation): failed to open stream: Network is unreachable in /home/p5O6Pd/prog.php on line 19
Request failed