Search
 
SCRIPT & CODE EXAMPLE
 

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
?>
Comment

how to get the link of the current page in php

<?php  
    if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')   
         $url = "https://";   
    else  
         $url = "http://";   
    // Append the host(domain name, ip) to the URL.   
    $url.= $_SERVER['HTTP_HOST'];   
    
    // Append the requested resource location to the URL   
    $url.= $_SERVER['REQUEST_URI'];    
      
    echo $url;  
  ?> 
Comment

current page link using php

$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $actual_link ;
Comment

php current page url

$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
$host     = $_SERVER['HTTP_HOST'];
$script   = $_SERVER['SCRIPT_NAME'];
$params   = $_SERVER['QUERY_STRING'];
 
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;
 
echo $currentUrl;
Comment

current page link using php

$url=$_SERVER['REQUEST_URI'];
echo $url;
Comment

php get current page url

<?php echo 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>
Comment

PREVIOUS NEXT
Code Example
Php :: route group controller laravel 
Php :: how to debug in php 
Php :: laravel 5.4 forelse 
Php :: please provide a valid cache path. laravel 
Php :: laravel date rule before 18 years ago 
Php :: wordpress wp_head 
Php :: how to delete a file in laravel 
Php :: php get domain from url 
Php :: count in string php 
Php :: pdo fetchall as object 
Php :: switch php 
Php :: larvel check two password 
Php :: laravel query builder join 
Php :: laravel where in subquery 
Php :: header location in php 
Php :: php get domain name with https 
Php :: maximum characters laravel validation 
Php :: readline php 
Php :: clear laravel cache 
Php :: Show all DB Tables in php 
Php :: laravel add timestamps to existing table 
Php :: laravel $loop interation 
Php :: php artisan migrate not working 
Php :: laravel delete file from storage 
Php :: tolower php 
Php :: csv to array in php 
Php :: increase upload limit in phpmyadmin docker 
Php :: yii2 arraydataprovider 
Php :: how to write php in javascript file 
Php :: php string only letters 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =