Get Current Page Php

[Solved] Get Current Page Php | Php - Code Explorer | yomemimo.com
Question : Get Current Page URL in PHP

Answered by : cl

<?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 : https://www.thiscodeworks.com/61037852e9b6cc0014b683c9 | Last Update : Fri, 06 Aug 21

Question : how to get the link of the current page in php

Answered by : wild-weasel

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

Source : https://www.javatpoint.com/how-to-get-current-page-url-in-php | Last Update : Wed, 11 Mar 20

Question : get current page php

Answered by : clear-civet-6y9w5jsi1gkp

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

Source : https://www.javatpoint.com/how-to-get-current-page-url-in-php | Last Update : Wed, 16 Dec 20

Question : php current page url

Answered by : vmxes

$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;

Source : https://phpf1.com/tutorial/get-current-page-url.html | Last Update : Thu, 24 Dec 20

Question : php current page

Answered by : said-hr

(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

Source : | Last Update : Tue, 29 Mar 22

Answers related to get current page php

Code Explorer Popular Question For Php