[thelist] Question re: domain name ownership

Maximillian Schwanekamp lists at neptunewebworks.com
Sat Oct 9 21:13:13 CDT 2004

Scott Wolpow wrote:

> I need a script that will read the domain name and display it on the 
> page. This is for "Domain for sale" Page.

> I prefer CGI or PHP. going to try the javascript that was left. I did 
> get the SSI to work. I am using a Virtual domain on Apache.

Using PHP, this is what you need to display the requested domain:
<?php echo $_SERVER['HTTP_HOST']; ?>
This will display the hostname, e.g. if your script is 
http://www.example.com/index.php, the above will output 
www.example.com.  If you want to remove the 'www.' you can probably get 
away with using str_replace():
<?php echo str_replace('www.','',strtolower($_SERVER['HTTP_HOST'])); ?>

Maximillian Von Schwanekamp
Dynamic Websites and E-Commerce
NeptuneWebworks.com <http://www.neptunewebworks.com/>
voice: 541-302-1438
fax: 208-730-6504

More information about the thelist mailing list