Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 5th, 2004, 10:17 AM
Registered User
 
Join Date: Jun 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Grabbing URL

I need to grab the host name from the URL. I've seen similar functions in other scripting languages, ie self_url(), but haven't found one in PHP. I'm doing this so that I can change which included header/footer files for different sites that use the same basic pages.
    For example, in a URL http://cdc.aibonline.org/php/testpage.php I need to be able to see that it is cdc.aibonline.org vs www.aibonline.org.
Any help? Thanks in advance
 
Old April 5th, 2004, 05:01 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Use $_SERVER['SERVER_NAME'] Or $_SERVER['HTTP_HOST']

Run a phpinfo() script to see other environment-related variables.

<?php
    phpinfo();
?>

: )
Rich


::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::





Similar Threads
Thread Thread Starter Forum Replies Last Post
Grabbing a section of a sound file BrianWren Pro VB 6 0 January 3rd, 2008 04:21 PM
Grabbing form variables jroxit Classic ASP Basics 5 June 18th, 2007 05:08 PM
Grabbing user login info Quick209 ASP.NET 2.0 Basics 1 May 12th, 2006 07:06 PM
Grabbing data from a WebTable Ahrenl Excel VBA 1 May 24th, 2005 12:34 PM
Grabbing Value From Textbox in subform bph Access 20 March 15th, 2005 05:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.