diff options
Diffstat (limited to 'html/public/fruitvote')
-rw-r--r-- | html/public/fruitvote/GoPage.php | 18 | ||||
-rw-r--r-- | html/public/fruitvote/health.php | 7 | ||||
-rw-r--r-- | html/public/fruitvote/stats.php | 7 |
3 files changed, 30 insertions, 2 deletions
diff --git a/html/public/fruitvote/GoPage.php b/html/public/fruitvote/GoPage.php index 864c1f7..7e03c35 100644 --- a/html/public/fruitvote/GoPage.php +++ b/html/public/fruitvote/GoPage.php @@ -4,7 +4,7 @@ class GoPage { private $socket; private $template; - public function __construct($page, $socket = "/home/simponic/fruitvote/http.sock", $template = "../template.html") { + public function __construct($page, $socket = "/home/lizzy/fruitvote/http.sock", $template = "../template.html") { $this->page = $page; $this->socket = $socket; $this->template = $template; @@ -24,9 +24,23 @@ class GoPage { curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, $this->socket); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + // forward query params + $query = $_SERVER['QUERY_STRING']; + if ($query) { + curl_setopt($ch, CURLOPT_URL, $url."?".$query); + } + + //forward post data + if ($_SERVER['REQUEST_METHOD'] === 'POST') { + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents('php://input')); + } + + $output = curl_exec($ch); curl_close($ch); - // todo: get headers / cookies, forward back response + + return $output; } diff --git a/html/public/fruitvote/health.php b/html/public/fruitvote/health.php new file mode 100644 index 0000000..8cea676 --- /dev/null +++ b/html/public/fruitvote/health.php @@ -0,0 +1,7 @@ +<?php + +require_once("GoPage.php"); + +$page = new GoPage("/health"); +echo $page->render(); +?> diff --git a/html/public/fruitvote/stats.php b/html/public/fruitvote/stats.php new file mode 100644 index 0000000..5147723 --- /dev/null +++ b/html/public/fruitvote/stats.php @@ -0,0 +1,7 @@ +<?php + +require_once("GoPage.php"); + +$page = new GoPage("/stats"); +echo $page->render(); +?> |