• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

Putting URL on page

Status
Not open for further replies.
Joined
Sep 13, 2005
Posts
2,479
Reaction score
104
Anyone know if it's possible to automatically put the current URL into the page. Say I want a landing page with the domain on it, but don't want to handcraft each page for each domain.

Thanks in advance
Johnny
 
Code:
<?php
echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
?>

That should do it..
 
I always use HTTP_HOST & PHP_SELF, I use PHP_SELF in forms as well as the place to submit it. Sometimes request URI has a habit of going pear shaped or returning fubar data.
 
Is it possible to return only the domain, without the page name?

Bruce
 
Skinner, have you got an example page with it on? I'm not too skilled in php.
 
$HTTP_HOST ought to just do the domain itself, explode() off the www or regex it to strip out the rubbish.

If you are building a holding page for names it is worth logging everything eg.

$date = date("l dS of F Y h:i:s A");
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $HTTP_USER_AGENT;
$os = $_ENV["OS"];
$referer = $HTTP_REFERER ;
$searchterm = "FRONTPAGE";

Nice and handy to find out who is visiting site, where they have come from, what they did prior to contacting you etc etc. Logging IP's can be handy to see previous visits as well.

Others do things far more in depth than the above, but it can be very handy :)
 
Poo I forgot to include the one without the file name.

Just remove the . $_SERVER['PHP_SELF'] to display just the address.

Also further to robs post may wanna look at

$_ENV["HTTP_USER_AGENT"]

Which includea the OS and some other info :)
 
Status
Not open for further replies.
Top Bottom