Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Get Current Page URL in PHP

<?php
$uri = $_SERVER['REQUEST_URI'];
echo $uri; // Outputs: URI 

$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; 
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
echo $url; // Outputs: Full URL 

$query = $_SERVER['QUERY_STRING'];
echo $query; // Outputs: Query String
?>
Source by www.thiscodeworks.com #
 
PREVIOUS NEXT
Tagged: #Get #Current #Page #URL #PHP
ADD COMMENT
Topic
Name
6+4 =