Learn How To Display Current Domain PHP Name Hostname Site Url Address

Mobile
feeds
Welcome Login | Register

Learn How To Display Current Domain PHP Name Hostname Site Url Address
  Forums Index
      » PHP Forums
        » » Learn How To Display Current Domain PHP Name Hostname Site Url Address



Learn How To Display Current Domain PHP Name Hostname Site Url Address
Post Description:
Post Tags: learn, how, to, display, current, domain, php, name, hostname, site, url, address, free php support, php scripts, php questions, php answers, programming, codes, scripts
This Post Has Been Viewed 664 Times Since Sat Jan 06, 2007 7:23 am Posted By hostman with 1 replies
Next Post »» How To Put or Add Text Data At Beginning of String PHP Begining Insert
Learn How To Display Current Domain PHP Name Hostname Site Url Address
Today i was writing a script and i wanted to know how i can learn to diplay or get the domain name and printed on the screen.

With php, this is simple. php has a function called getenv().

it displays the current domain name:

for example, if i were to run this code:


     Code:
<?php

echo getenv('HTTP_HOST');

?>



the output will look like this if the url was: http://www.wallpaperama.com/thisfile.php


     Code:
www.wallpaperama.com



NOTE: in order for this to work on your site, you will need to have PHP. If you don't have PHP hosting on your site, you can start by singing up with our friends at www.webune.com - We recommend them to all our customer.


Leave Your Comments






Share
URL:
You can use this HTML code to put it on your website to show your friends this wallpaper. Use this code on your profile like myspace, friendster, Facebook or others. Just Copy and Paste it in your HTML on your websites



Fourms BBCODE:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums





Comments and replies About Learn How To Display Current Domain PHP Name Hostname Site Url Address




:: 1 :: Reply #42713 Reply By tech support On Sat Feb 23, 2008 12:02 pm