-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathapi.php
More file actions
24 lines (20 loc) · 602 Bytes
/
api.php
File metadata and controls
24 lines (20 loc) · 602 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
include('./defaults.php');
if($_GET['method'] == 'siteLinks.getLink') {
redirect_url(BASE_URL.'/site_links.php?action=display&id='.$_GET['id']);
}
// Requests from the same server don't have a HTTP_ORIGIN header
if(!array_key_exists('HTTP_ORIGIN', $_SERVER)) {
$_SERVER['HTTP_ORIGIN'] = $_SERVER['SERVER_NAME'];
}
$parameters = array(
'version'=>$_GET['version'],
'request'=>$_GET['request'],
'origin'=>$_SERVER['HTTP_ORIGIN']
);
try {
echo $PMDR->get('API',$parameters)->process();
} catch (Exception $e) {
echo json_encode(array('error'=>$e->getMessage()));
}
?>