web.php 936 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. chdir("../../");
  3. header("Content-Type: application/json");
  4. include "data/config.php";
  5. if(config::API_ENABLED === false){
  6. echo json_encode(["status" => "The server administrator disabled the API!"]);
  7. return;
  8. }
  9. include "lib/frontend.php";
  10. $frontend = new frontend();
  11. /*
  12. Captcha
  13. */
  14. include "lib/bot_protection.php";
  15. $null = null;
  16. new bot_protection($null, $null, $null, "web", false);
  17. [$scraper, $filters] = $frontend->getscraperfilters(
  18. "web",
  19. isset($_GET["scraper"]) ? $_GET["scraper"] : null
  20. );
  21. $get = $frontend->parsegetfilters($_GET, $filters);
  22. if(
  23. isset($_GET["extendedsearch"]) &&
  24. $_GET["extendedsearch"] == "yes"
  25. ){
  26. $get["extendedsearch"] = "yes";
  27. }else{
  28. $get["extendedsearch"] = "no";
  29. }
  30. try{
  31. echo
  32. json_encode(
  33. $scraper->web($get),
  34. JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_IGNORE
  35. );
  36. }catch(Exception $e){
  37. echo json_encode(["status" => $e->getMessage()]);
  38. }