Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php current url

 $currentUrl = $_SERVER['REQUEST_URI'];
Comment

php get current page url

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

php current url

function url_origin( $s, $use_forwarded_host = false )
{
    $ssl      = ( ! empty( $s['HTTPS'] ) && $s['HTTPS'] == 'on' );
    $sp       = strtolower( $s['SERVER_PROTOCOL'] );
    $protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' );
    $port     = $s['SERVER_PORT'];
    $port     = ( ( ! $ssl && $port=='80' ) || ( $ssl && $port=='443' ) ) ? '' : ':'.$port;
    $host     = ( $use_forwarded_host && isset( $s['HTTP_X_FORWARDED_HOST'] ) ) ? $s['HTTP_X_FORWARDED_HOST'] : ( isset( $s['HTTP_HOST'] ) ? $s['HTTP_HOST'] : null );
    $host     = isset( $host ) ? $host : $s['SERVER_NAME'] . $port;
    return $protocol . '://' . $host;
}

function full_url( $s, $use_forwarded_host = false )
{
    return url_origin( $s, $use_forwarded_host ) . $s['REQUEST_URI'];
}

$absolute_url = full_url( $_SERVER );
echo $absolute_url;
Comment

PREVIOUS NEXT
Code Example
Php :: check php version linux terminal 
Php :: php get version 
Php :: laravel sentence word count 
Php :: php divide string into parts 
Php :: laravel blade short if 
Php :: replace all php 
Php :: php curl ssl certificate problem 
Php :: how to link external php file to html 
Php :: wordpress wp_head 
Php :: how to increase request timeout in laravel 
Php :: unique sql queries laravel 
Php :: laravel get class name 
Php :: laravel dynamic page title 
Php :: jetstream seed user with team 
Php :: php convert link to embed youtube 
Php :: auto submit button php 
Php :: codeigniter count rows 
Php :: php serve 
Php :: php array formatted output 
Php :: laravel active nav 
Php :: php form examples tutorials with code 
Php :: pdo php check if row exist 
Php :: Laravel - create model, controller and migration in single artisan command 
Php :: foreach loop in php 
Php :: laravel delete file from storage 
Php :: Get date without time in laravel 
Php :: laravel migration add date of birth column 
Php :: carbon add few hours 
Php :: inner join codeigniter 
Php :: Database//Eloquent//Model.php laravel errror array t- string conversion 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =