Category: >> PHP Code >> Get Current Page URL Bookmark and Share

<< lastnext >>

Snippet Name: Get Current Page URL

Description: This will return the URL of the current page or script. Works with HTTP and HTTPS, as well as irregular port numbers (i.e. other than port 80).

Also see:
» Simple directory viewer / browser
» Read a web page directly in to a s...
» Recursive Directory Browser
» Get the URL of the referring page
» Allow access to a page only once
» Check if current session is using ...
» Validate A URL
» Parse A URL Into Pieces
» Show the current season (spring, s...
» Read GET URL Variables Into An Ass...
» Saving Remote Images With PHP
» Include All Files In A Directory
» More File Type Detection in PHP
» Fix missing $_SERVER SCRIPT_URL va...
» Get Current Directory Name
» Measure script run time
» USERS: view currently connected us...
» Database Links: CURRENT_USER
» TIMESTAMP: Get current timestamp
» Date functions: CURRENT_DATE
» Date functions: Current Date
» Show info on current context
» url_decode that respects utf8 char...
» Extract and Display all links on a...
» Easy page browser
» Create an HTML page on demand
» Write to File example
» Show current time as PNG-image
» Check if a file exists

Comment: (none)

Author: CoderZone
Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
 } else {
 return $pageURL;
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© | users online: 7