Display Browser URL on webpage

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sbridge
Forum Newbie
Posts: 12
Joined: Tue Apr 10, 2007 2:50 pm

Display Browser URL on webpage

Post by sbridge »

I am attempting to create a parked page, but I'm having some difficulties with getting something the way I'd like it.

I want someone to be able to log onto the website and by automation, have it display the URL and say "is parked."
eg: http://www.devnetwork.net is parked

I would like it to pull the url from the browser... this way I don't have to manually enter it on each domain I park.

I was browsing through some javascripts, but no luck there and then I thought maybe I might get lucky here... any suggestions?

thnx :D
sbridge
Forum Newbie
Posts: 12
Joined: Tue Apr 10, 2007 2:50 pm

found this, but so confused

Post by sbridge »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I found this, but I have no clue what to do with this... 


"

Code: Select all

<?php 
function selfURL() { 
    $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; 
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; 
    $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); 
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; 
} 
function strleft($s1, $s2) { 
    return substr($s1, 0, strpos($s1, $s2)); 
} 
?>

so you can use it by invoking selfURL() function "


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

$_SERVER['HTTP_HOST'];
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I would use the function posted by Burrito some time ago called getURL. It's a bit more straight-forward.

viewtopic.php?t=37950&highlight=geturl
sbridge
Forum Newbie
Posts: 12
Joined: Tue Apr 10, 2007 2:50 pm

Sweet!

Post by sbridge »

awesome... you guys rock! thanks!
Post Reply