The thing is that for a newsletter plugin, I want to check if in my newsletter settings the chosen unsubscribe CMS page has the parameter ‘:token’. This parameter is then later used to create a link to that page, where a component should be placed.
I would like to make it as user friendly as possible, so if somebody forgot to add ‘:token’, I show a application error.
Can I make a HTTP request to my own page and then check?
With URL creation the parameters can be added and then tested if string contains these parameters. e.g.:
$newsletterUnsubscribeCmsPage = Page::url($this->newsletter_unsubscribe_cms_page, ['token' => 'token']);
if (strpos($newsletterUnsubscribeCmsPage, 'token') === false) {
throw new \ApplicationException('The URL of your newsletter unsubscribe page needs to contain "/:token" at the end of the URL.');
}