$_SERVER['SERVER_NAME']in my script to build a FROM email header.
I want to sanitize the value before using it, but having difficulties finding the proper function for that. I want to get the URL without
Without sanitizing it will output the way I want:
$domain = $_SERVER['SERVER_NAME']; www.my-domain.com
This will output the full URL:
$domain = esc_url_raw($_SERVER['SERVER_NAME']); http://www.my-domain.com
This will strip the . characters from the URL:
$domain = sanitize_key($_SERVER['SERVER_NAME']); wwwmy-domaincom
I prefer using a native PHP/WP function instead of using extra functions to alter my output, such as
- You must be logged in to reply to this topic.