Need help identifing the URL used to pull up a web page.

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
DennisHenry
Forum Newbie
Posts: 1
Joined: Sat Mar 22, 2008 5:20 pm

Need help identifing the URL used to pull up a web page.

Post by DennisHenry »

I'm not a php programmer, but do understand programming logic and html. Here's what I need help on.

Let's say I pull up a web page using the url: "NEBRASKA-TOOLS.COM". I want to use php embedded in the index page to identify the url, then print out a specific word base on the url.

For example if the url is NEBRASKA-TOOLS.COM, i'd like $urlcity = "Nebraska" and then i'd like to echo the $urlcity thoughout the webpage.

Need help with the code to pull this off.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Need help identifing the URL used to pull up a web page.

Post by Weirdan »

start with:

Code: Select all

 
echo htmlspecialchars($_SERVER['HTTP_HOST']);
 
Post Reply