Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home PHP PHP Get Current Web Page URL

PHP Get Current Web Page URL

If you are asking how to get current web page url that is being shown in the browser URL bar or which page url your visitor is browser for some reasons. You can do this with a PHP function below:

<?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;
	}
?>

<?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; } ?>

Mar 9, 2011Hoan Huynh
Change or reset MySQL Root Account PasswordPHP Auto Post A Story Content To Digg, StumbleUpon, Tumblr and LinkedIn
You Might Also Like:
  • How To Track Website With Multiple Google Analytisc Accounts
  • Facebook Like Button And Recommend Button With fb:like, iframe and html5
  • Get Image Width Height With JQuery And JavaScript
  • Create Count Down Download Page With JavaScript
  • Jquery checkbox checked
  • Display User Current Location On Google Map
  • Javascript Problem Set focus textbox on Firefox
  • Auto Rotate Web Page Title With JavaScript
  • JavaScript Get Radio Button Value
  • Javascript generate a random number using Math.random
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

10 years ago PHPREQUEST_URI, SERVER_NAME, SERVER_PORT90
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
22,152 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
20,033 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,812 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,291 views
C# Read Json From URL And Parse/Deserialize Json
9,782 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Essay For Sale – How To Write A Superb One That Will Sell
  • Free Online Photo Editor
  • Strategies For Finding Your Research Paper Requires
  • How Fast Should You Write a Written Essay?

  • What To Look For In A Research Paper Writing Service
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (100)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development