How to get the value of a GET in PHP

Asked

Viewed 41 times

-4

  • I’m using the PHP_URL_QUERY

  • What comes.... in the request? OR in any URL? The two Urls you have placed are completely different, so you could better describe what you want to do?

  • Hello ! I would like to take the value of the example request https://foo.com/acme "Acme" is the value I would like to capture. Thank you !

  • Tried to PHP_URL_PATH?

  • Yes tried but using PHP_URL_PATH it just shows the folder name :(

  • No, it will be /acme, what you want (https://ideone.com/6Bklm0)

  • Yes, I need to get the "Acme" but my code only works if I use it as follows: "https://foo.com/? Acme" I would like to use "https://foo.com/acme" without using the question mark. I get the result using : $url = $_SERVER['REQUEST_URI']; echo parse_url($url, PHP_URL_PATH);

  • It got a little confused what you want, because using PHP_URL_QUERY would return to you "/Acme", that would not be your goal ?

  • Yes this is my goal, however nay I wish to use question mark. https://foo.com/**? **Acme

  • I’m still confused. I can’t decode if you want to use parse_url or if you want to rewrite the URL with . HTACCES https://answall.com/questions/71447/howto modify

  • So that’s exactly what I’ve been through. It’s pretty confusing what you’re doing, so I voted to close the question as not clear enough.

  • Let’s go ... https://www.instagram.com/nome.do.usuario How I get the "name.do.user." ?

  • That’s it right there ideone.com/dTjEK1(<--- This here is a link to an example, click on this link) you’re trying to do?

Show 8 more comments

1 answer

-3

If you use Apache as a server, you can set rules using mod_rewrite.

You can put these rules in the . htacess file and put the following rule:

RewriteEngine on
RewriteRule ^acme/*?$ teste.php?p=acme [QSA] [L]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.