Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. <?php
  2. //Copyright 2016 Dirk Elmendorf
  3.  
  4. //This simulates a slow request to a remote api
  5.  
  6.  
  7. if (isset($_GET["seconds"]) && $_GET["seconds"] != "null") {
  8. $seconds = $_GET["seconds"];
  9. }
  10. else {
  11. $seconds = 5;
  12. }
  13. sleep($seconds);
  14. header('Content-Type: application/json');
  15. $data = array('delay' => $seconds);
  16. echo(json_encode($data));
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement