All In One Script
MENU

How to Get Domain Name from URL in PHP

by 12:49:00 AM
undefined
How to Get Domain Name from URL in PHP Parse domain name from URL is used in many cases in the web project. In this short tutorial, we’ll provide a simple code snippet to get domain name from URL in PHP. Using our example script, you’ll be able to extract only the domain name from any type of URL. All PHP code are group together in getDomain() function. The $url param should be passed to getDomain() function, from which you want to get the domain name. getDomain() function returns

Get current Domain URL in PHP

by 4:25:00 AM
undefined
Get current Domain URL in PHP I have my site on server http://www.myserver.uk.com For this i have two domain: http://one.com and http://two.com i would like get with PHP current domain, but if I use $_SERVER['HTTP_HOST'] then this show me myserver.uk.com instead of: one.com or two.com How can i get domain, not the server name? I have PHP version 5.2 Answer : try using this: $_SERVER['SERVER_NAME'] EDIT: apache_request_headers() or parse $_SERVER['REQUEST_URI']

Instagram