4
0

index.php 531 B

1234567891011121314151617181920
  1. <?php
  2. require_once '../api/functions.php';
  3. define("API_HOST", getServerPath(false) . '');
  4. $dirs = [
  5. '../api/plugins',
  6. '../api/v2',
  7. ];
  8. $openapi = \OpenApi\scan($dirs);
  9. ob_start();
  10. header('Content-Type: application/json');
  11. $json = $openapi->toJson();
  12. echo $json;
  13. // Return the contents of the output buffer
  14. $htmlStr = ob_get_contents();
  15. // Clean (erase) the output buffer and turn off output buffering
  16. ob_end_clean();
  17. // Write final string to file
  18. file_put_contents('./api.json', $htmlStr);
  19. header("Location: home/");
  20. echo $json;