disable_api) { echo "

" . TEXTS["api_unavailable"] . "

"; die(); } require_once "misc/tools.php"; if (!$opts->query) { echo "

Example API request: ./api.php?q=gentoo&p=2&t=0


\"q\" is the keyword

\"p\" is the result page (the first page is 0)

\"t\" is the search type (0=text, 1=image, 2=video, 3=torrent, 4=tor)


The results are going to be in JSON format.

The API supports both POST and GET requests.

"; die(); } $results = fetch_search_results($opts, false); if (array_key_exists("error", $results)) { http_response_code(500); } header("Content-Type: application/json"); echo json_encode($results); ?>