PHP FULL URL
From w3cyberlearnings
Contents |
PHP CURRENT Full URL
Get current Full URL.
Example 1
<?php //www.woowood.com/request.php?ac=33; echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>
Output
www.woowood.com/request.php?ac=33;
Example 2
<?php $proto = strtolower($_SERVER['SERVER_PROTOCOL']); $protocol = strpos($proto, 'https') === TRUE ? 'https' : 'http'; $host = $_SERVER['HTTP_HOST']; $script = $_SERVER['SCRIPT_NAME']; $params = $_SERVER['QUERY_STRING']; $URL = $protocol . '://' . $host . $script . '?' . $params; echo $URL; ?>
Related Links
Manage URL