In PHP if I have the following script:
var_dump($_REQUEST);
How can I differentiate the following requests:
GET /foo?hello%20dude=cool
GET /foo?hello_dude=cool
they both print:
array(1) { ["hello_dude"]=> string(4) "cool" }
since key names are not allowed to have spaces? Do I have to manually parse the POST data as well as the GET data or is there an easier way?
I think you are going to have to bypass PHP's automatic parsing of the query string and do it yourself.
You can get the full request URI by checking $_SERVER['REQUEST_URI']
. From there, you can split on the first question mark ?
, then split on ampersand &
, then split each by =
. There may also be a handy regex solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With