diff options
author | Lizzy Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-10 16:45:26 -0600 |
---|---|---|
committer | Lizzy Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-10 16:45:26 -0600 |
commit | def61909c2423b19b063a5807cc399a41de39974 (patch) | |
tree | 0b035fbb1c29ac858b042092d183824f8bc1a5b5 /html/public/fruitvote | |
parent | 5a85dd89bc82d8fc133c0e9a58859ae9b98dbe0f (diff) | |
download | tilde.club-def61909c2423b19b063a5807cc399a41de39974.tar.gz tilde.club-def61909c2423b19b063a5807cc399a41de39974.zip |
fruitvote
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(); +?> |