0
I have a question that I believe is simple for almost everyone, but I did not find any material that really help me to solve this.
I am developing a micro-service in php that has as its sole objective to reuse a set of functions in php that I took from another application.
So far so good, but one of the main functions of this set does a check of the current url, being it in a format similar to ".../users/{userid}" to use this userid for a certain processing.
The question is as follows: how do I, when I type something like ".../users/15" in the browser, redirect me to this function file and play the value 15 where is "{userid}"?
Edit 1:I managed by solving using the user url method in the reply marked as the appropriate, thank you all.
In case you are connecting to a database or are you trying to return data from an html page? I searched here and found this site http://www.mauricioprogramador.com.br/posts
– Iuri De Lima Marques
I’m not using a bank. What I’m going to do is take the id that the user type at the end of the url and pass to the function I described there so that it checks on social networks and returns a result according to what the query results. I could even change to GET but I can’t change the function code because it’s a shared code
– adrianosmateus
Regarding redirect, you will need to configure the file
.htaccess
to get every url in php you can use$_SERVER["REQUEST_URI"]
. Search for friendly url– Costamilam
I looked at the internet and saw that depending on the service or site, the information can be returned in JSON,XML among others. But all by the GET method. I don’t know if you can do it the way you described.
– Iuri De Lima Marques
Take a look at the suggestion I put in at the end. It will probably answer you.
– Andrei Coelho