Current url and url origin php [duplicated]

3

How can I get with php the url current where the script is running?

Is it possible to obtain what is the url of origin if there is one?

Example:

If the url is: https://es.stackoverflow.com/posts/76245/edit how can I get it with php ??

    
asked by 06.06.2017 в 12:08
source

1 answer

4

You can use $_SERVER["SCRIPT_NAME"] that, as indicated in the documentation :

  

Contains the current script path. This is useful for pages that need to point to themselves. The constant FILE contains the absolute path and the name of the current file included.

    
answered by 06.06.2017 в 12:13