- preg_replace: documentation ( source)
- define: documentation ( source)
<?php
define('COURSE_PORTAL_URL', "https://learn.kognito.com/auth");
$pattern = '/https?:\/\/learn[.]kognito[.]com\/auth/';
$replacement = COURSE_PORTAL_URL;
$courseData['auth_url'] = preg_replace($pattern, $replacement, $inputURL, 1);
echo $courseData['auth_url'] . "?k=" . $cookie_id;