pkgfuncs.inc.php: Remove a conflict marker
[aur.git] / web / html / rpc.php
blob415dcb82615d62b21a178bc7090dd558ce83d250
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 <h2>Allowed methods</h2>
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 <h2>Examples</h2>
33 <dl>
34 <dt><tt>search</tt></dt><dd><tt>http://aur-url/rpc.php?type=search&amp;arg=foobar</tt></li></dd>
35 <dt><tt>info</tt></dt><dd><tt>http://aur-url/rpc.php?type=info&amp;arg=foobar</tt></dd>
36 <dt><tt>multiinfo</tt></dt><dd><tt>http://aur-url/rpc.php?type=multiinfo&amp;arg[]=foo&amp;arg[]=bar</tt></dd>
37 <dt><tt>msearch</tt></dt><dd><tt>http://aur-url/rpc.php?type=msearch&amp;arg=john</tt></li></dd>
38 <dt>Callback</dt><dd><tt>http://aur-url/rpc.php?type=search&amp;arg=foobar&amp;callback=jsonp1192244621103</tt></dd>
39 </dl>
40 </body></html>
41 <?php
42 // close if statement