Quick Search:
 
 PHP Code: Get Current Page URL Jump to:  
Category: >> PHP Code >> Get Current Page URL  

<< 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:
» Show the current season (spring, summe...
» Read GET URL Variables Into An Associa...
» Saving Remote Images With PHP
» Include All Files In A Directory
» More File Type Detection in PHP
» Fix missing $_SERVER SCRIPT_URL variab...
» Get Current Page URL
» Get Current Directory Name
» Measure script run time
» USERS: view currently connected users
» 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 characte...
» Extract and Display all links on a web...
» Easy page browser
» Create an HTML page on demand
» Write to File example
» Show current time as PNG-image
» Check if a file exists
» Page creation time #2
» Page creation time
» Find the current URL of the page
» Export table to Excel or MS Word file
» Heavy Duty URL validator
» Split URL into parts ver A
» Preview URL or Page On Hover
» Trippy Page

Comment: (none)

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

<?PHP
 
FUNCTION curPageURL() {
 
 $pageURL = 'http';
 IF ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 
 $pageURL .= "://";
 
 IF ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 
 } ELSE {
 
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 
 RETURN $pageURL;
 
}
 
?>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org