test - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of test.php

  1. <?php
  2.  
  3. // Script to access REST API: https://ssl.eventilla.com/v1/
  4.  
  5. $accountID = 2115435; // data provided
  6. $key = "d48c7f4a664fb763f0ca657a2f54de03e235a048e5e0fff58a82680aac324c9d"; // data provided
  7.  
  8. // Fetch all events where the user has access to
  9. $uri = "https://ssl.eventilla.com/v2/events/";
  10.  
  11. // Fetch information about attendee with id 123456
  12. // Fields can be left out to speed up the query
  13. //$uri = "https://ssl.eventilla.com/v2/events/123456/attendees?fields=firstname,lastname,email,data,ticket,registered,status";
  14.  
  15. // Fetch information about event with hashid ABCD12
  16. //$uri = "https://ssl.eventilla.com/v2/events/ABCD12/attendees?fields=firstname,lastname,email";
  17.  
  18. // Get all attendees and their information from event ABCD12
  19. //$uri = "https://ssl.eventilla.com/v2/events/ABCD12/attendees?fields=firstname,lastname,email,data,ticket,links,registered,status,invoice,extras,transaction";
  20.  
  21. // Fetch information about event with hashid ABCD12 in Finnish (event description, location, form fields can be translated)
  22. //$uri = "https://ssl.eventilla.com/v2/events/ABCD12?language=FI";
  23.  
  24. // Fetch only events that are in published state and their start_date is in the future
  25. //$uri = 'https://ssl.eventilla.com/v2/events/?published=true&past_events=false';
  26.  
  27. $uriPath = parse_url($uri)["path"];
  28.  
  29. $method = "GET";
  30. $date = gmdate('D, d M Y H:i:s T');
  31.  
  32. $contentMD5 = "";
  33. $contentType = "";
  34.  
  35. $dataString = $method . "\n" . $contentMD5 . "\n" . $contentType . "\n" . $date . "\n" . "\n" . $uriPath;
  36.  
  37. $sha1 = hash_hmac('sha1', $dataString, $key, true);
  38. $base64 = base64_encode($sha1);
  39.  
  40. // Get cURL resource
  41. $curl = curl_init();
  42.  
  43. // Set some options
  44. curl_setopt_array($curl, array(
  45.     CURLOPT_RETURNTRANSFER => 1,
  46.     CURLOPT_URL => $uri,
  47.     CURLOPT_HTTPHEADER => ["Date: $date", "Content-MD5: $contentMD5", "Content-Type: ", "Authorization: KVWS $accountID:$base64"],
  48.     CURLOPT_VERBOSE => true
  49. ));
  50.  
  51. // Send the request & save response to $resp
  52. $resp = curl_exec($curl);
  53.  
  54. // Close request to clear up some resources
  55. curl_close($curl);
  56.  
  57. var_dump($resp);
File Description
  • test
  • PHP Code
  • 12 Sep-2019
  • 2.02 Kb
You can Share it: