forked from dotkom/notifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
45 lines (43 loc) · 1.12 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
$url = $_REQUEST["url"];
if ($url) {
// Allowed addresses
$addresses = array(
"https://online.ntnu.no/feeds/news/",
"https://online.ntnu.no/api/",
"https://online.ntnu.no/service_static/",
"http://draug.online.ntnu.no/",
"https://www.sit.no/ajaxdiner/get",
"https://www.sit.no/rss.ap",
"http://www.sit.no/rss.ap",
"http://api.visuweb.no/bybussen/"
);
foreach ($addresses as $address) {
if (strpos($url, $address) !== false) {
$data = $_REQUEST["data"];
// POST request
if ($data) {
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => $data,
),
);
$context = stream_context_create($options);
echo file_get_contents($url, false, $context);
break;
}
// GET request
else {
echo file_get_contents($url);
break;
}
}
}
}
else {
header('Location: mobile.html');
}
?>