Current url and url origin php [duplicated]


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?


If the url is: how can I get it with php ??

asked by 06.06.2017 в 12:08

1 answer


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