po/POTFILES: Fix library file paths
[aur.git] / web / html / rpc.php
blobee7cda3de6e3a2af5f9aea8abd9bba85dcd62855
1 <?php
2 set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
3 include_once("aurjson.class.php");
5 if ( $_SERVER['REQUEST_METHOD'] != 'GET' ) {
6 header('HTTP/1.1 405 Method Not Allowed');
7 exit();
10 if ( isset($_GET['type']) ) {
11 $rpc_o = new AurJSON();
12 echo $rpc_o->handle($_GET);
14 else {
15 // dump a simple usage output for people to use.
16 // this could be moved to an api doc in the future, or generated from
17 // the AurJSON class directly with phpdoc. For now though, just putting it
18 // here.
20 <html><body>
21 <p>The methods currently allowed are:</p>
22 <ul>
23 <li><tt>search</tt></li>
24 <li><tt>info</tt></li>
25 <li><tt>multiinfo</tt></li>
26 <li><tt>msearch</tt></li>
27 </ul>
28 <p>Each method requires the following HTTP GET syntax:</p>
29 <pre>type=<em>methodname</em>&amp;arg=<em>data</em></pre>
30 <p>Where <em>methodname</em> is the name of an allowed method, and <em>data</em> is the argument to the call.</p>
31 <p>If you need jsonp type callback specification, you can provide an additional variable <em>callback</em>.</p>
32 <p>Example URL: <tt>http://aur-url/rpc.php?type=search&amp;arg=foobar&amp;callback=jsonp1192244621103</tt></p>
33 </body></html>
34 <?php
35 // close if statement