WebRef.eu  - Internet Marketing and Online Business Resources  

Home / Site Map | Contact

 

Obtain Site Domain Name in PHP

Sometimes you want to automatically obtain the site domain name in PHP. This technique means you don't have to hard code references to the site domain name in your script, making it easier for your script to be used on other sites.

E.g. if the url of your script was:

http://www.mysite.co.uk/show-review.php

and you wanted to put the site domain into a variable, i.e. put www.mysite.co.uk into a variable, the code to use would be:

<?php
$domain = $_SERVER['HTTP_HOST'];
?>

 




Low Prices UK Shopping

Compare Prices
at LowPrices.co.uk


Home / Site Map | Contact

All Content ©2020 WebRef.eu