Frankie Posted May 16, 2013 Share Posted May 16, 2013 Hello, I'm trying to write a PHP script that would load an image based on the URL. For example, if www.site1.domain.com is present, then load site1 header image, or if www.site2.domain.com is present, load site2 header image and so fourth. Wondering what would be the best approach on this. Thanks! Link to comment Share on other sites More sharing options...
HartleySan Posted May 16, 2013 Share Posted May 16, 2013 The $_SERVER superglobal is probably your best bet: http://www.php.net/manual/en/reserved.variables.server.php Run the following script on your server to get an idea of all the info it contains: <?php echo '<pre>'; print_r($_SERVER); echo '</pre>'; 1 Link to comment Share on other sites More sharing options...
Frankie Posted May 17, 2013 Author Share Posted May 17, 2013 That's what I had in mind, I was just curious of other options. Thank you for your feedback. Link to comment Share on other sites More sharing options...
HartleySan Posted May 17, 2013 Share Posted May 17, 2013 The following links might also be of use: http://stackoverflow.com/questions/1408996/best-way-to-get-hostname-with-php http://php.net/manual/en/function.gethostname.php http://php.net/manual/en/function.parse-url.php Link to comment Share on other sites More sharing options...
Recommended Posts