LibreY

- privacy respecting meta search engine
git clone git://git.acid.vegas/LibreY.git
Log | Files | Refs | Archive | README | LICENSE

api.php (764B)

      1 <?php
      2     require "misc/tools.php";
      3     require "misc/search_engine.php";
      4     require "locale/localization.php";
      5 
      6     $opts = load_opts();
      7 
      8     if (!$opts->query) {
      9         echo "<p>Example API request: <a href=\"./api.php?q=gentoo&p=2&t=0\">./api.php?q=gentoo&p=2&t=0</a></p>
     10         <br/>
     11         <p>\"q\" is the keyword</p>
     12         <p>\"p\" is the result page (the first page is 0)</p>
     13         <p>\"t\" is the search type (0=text, 1=image, 2=video, 3=torrent, 4=tor)</p>
     14         <br/>
     15         <p>The results are going to be in JSON format.</p>
     16         <p>The API supports both POST and GET requests.</p>";
     17 
     18         die();
     19     }
     20 
     21     $results = fetch_search_results($opts, false);
     22     header("Content-Type: application/json");
     23     echo json_encode($results);
     24 ?>