How to get current full URL in PHP andrey вторник, 3 июня 2014 г. No Comment

To get current full url in php, we can use php's $_SERVER variables.

We are going to use
  • $_SERVER[REQUEST_SCHEME]  - It will print which type scheme (ex.http)
  • $_SERVER[HTTP_HOST]       -  Server host name
  • $_SERVER[REQUEST_URI]      - current URI 
So, We can combine those three like below,
$URL = $_SERVER[REQUEST_SCHEME].'://'.$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
 Simply echo it like this echo $_URL; to test it.

Have any doubt, feel free to comment here!

Related Post : How to get full referrer url in php

    To get current full url in php, we can use php's $_SERVER variables.

    We are going to use
    • $_SERVER[REQUEST_SCHEME]  - It will print which type scheme (ex.http)
    • $_SERVER[HTTP_HOST]       -  Server host name
    • $_SERVER[REQUEST_URI]      - current URI 
    So, We can combine those three like below,
    $URL = $_SERVER[REQUEST_SCHEME].'://'.$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
     Simply echo it like this echo $_URL; to test it.

    Have any doubt, feel free to comment here!

    Related Post : How to get full referrer url in php

      by Jillur Rahman

      Jillur Rahman is a Web designers. He enjoys to make blogger templates. He always try to make modern and 3D looking Templates. You can by his templates from Themeforest.

      Follow him @ Twitter | Facebook | Google Plus

      No Comment