I'm working on CakePHP 3.4
I have a shell script to run as cron and send email to the user, email contains a link back to the website to specified controller.
To achieve this, I'm using Router::url()
in the Shell to generate base url becuase Html->link
is not working there
$fullBaseUrl = Router::url('/', true);
$scan_result_url = Router::url(['controller' => 'Notifications', 'action' => 'notificationRedirect', $notification->id], true);
But this is generating url with localhost as host like
http://localhost/notifications/notification-redirect/<id>
Same line in Controller when tested gives url to be
http://mywebsite.com/notifications/notification-redirect/<id>
How can I get full url in Shell. My website is hosted on server and using mywebsite.com
to access it?