Can I trust on $_SERVER['SERVER_NAME'] value?
If not, how I can figure out the server name in a secure way.
Thanks
No.
You can use
$host = `hostname`;