1
For example, I have the following URL generated with ngRoute
of AngularJS
: https://www.projeto.com/edit/25
, 25 is the ID, I need to get this ID in PHP.
In researches, I found the following solution to get the URL in PHP:
$url = $_SERVER[REQUEST_URI]
But the problem is that it returns the wrong URL, returns https://www.projeto.com/edita.php
instead of the angular generated URL (https://www.projeto.com/edit/25
).
Is there any way to get the current browser URL in php?
Give a print_r($_SERVER) and see the options the server has. I believe the value you want will be in the list.
– Bruno Rigolon
@Brunorigolon Thanks! There you have the option
HTTP_REFERER
which is exactly what I need. Put the answer in the question. :)– user70361
It would be very interesting also for you to post here the . htaccess rules for the URL rewriting.
– Gustavo Jantsch