test.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. exit;
  3. require_once __DIR__.'/../inc/global.inc.php';
  4. require_once '../inc/conf/configuration.php';
  5. ?>
  6. <html>
  7. <body>
  8. <div class="results">
  9. <?php
  10. $server = api_get_path(WEB_CODE_PATH).'webservices/';
  11. $serversys = api_get_path(SYS_CODE_PATH).'webservices/';
  12. //$script = 'registration.soap.php';
  13. $script = isset($_POST['script']) ? $_POST['script'] : false;
  14. $function = isset($_POST['function']) ? $_POST['function'] : false;
  15. $contact = $server.$script.'?wsdl';
  16. $client = new nusoap_client($contact);
  17. $err = $client->getError();
  18. if ($err) {
  19. // Display the error
  20. echo '<h2>Constructor error</h2><pre>'.$err.'</pre>';
  21. // At this point, you know the call that follows will fail
  22. }
  23. $response = [];
  24. if (!empty($function)) {
  25. $response = $client->call($function);
  26. echo '<pre>';
  27. print_r($response);
  28. echo '#</pre>';
  29. } else {
  30. echo "empty function $function";
  31. }
  32. $list = scandir($serversys);
  33. $scripts = [];
  34. foreach ($list as $item) {
  35. if (substr($item, 0, 1) == '.') {
  36. continue;
  37. }
  38. if (substr($item, -8) == 'soap.php') {
  39. $scripts[] = $item;
  40. }
  41. }
  42. ?>
  43. </div>
  44. <form method="POST" action="">
  45. <label for="script">Script</label>
  46. <select name="script">
  47. <?php
  48. foreach ($scripts as $script) {
  49. echo '<option value="'.$script.'">'.$script.'</script>';
  50. }
  51. ?>
  52. </select><br />
  53. <label for="function">Function</label>
  54. <input type="text" name="function" value="<?php echo $function; ?>"></input><br />
  55. <label for="param[0]">Param 0</label>
  56. <input type="text" name="param[0]" ></input><br />
  57. <input type="submit" name="submit" value="Send"/>
  58. </form>