<?php
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>
We are using these two php functions to get complete web page url from address bar. These two functions are
- $_SERVER['HTTP_HOST']
- $_SERVER['REQUEST_URI']
$_SERVER['HTTP_HOST'] this builtin php function will show you only server name, e.g www.yoursite.com .
$_SERVER['REQUEST_URI'] this builtin php function will show you the path to file of your url e.g www.yoursite.com/yourpage.php
So this is the way to get complete web page url from address bar in php
0 comments:
Post a Comment