Trying to incorporate a third party script in a plugin. On page load it sends a GET request to a page/uri of my choosing, which I would like to answer. However, I only know how to do this for POST requests:
public function onPagesInitialized(Event $event) {
$uri = $this->grav['uri'];
$page = $this->grav['page'];
$this->ajax_url = "/a-specific-non-page-uri";
if ($this->ajax_url && $this->ajax_url == $uri->path()) {
echo "now I can handle the POST request";
}
}`
This works perfectly, but not for GET requests. How do I catch those in Grav? If anyone knows another plugin with something like this, I would love to take a peek!