Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Url Encode - Decode

Tags:

php

urlencode

I passed email to my URL like that:

http://www.mysite.com?email=external%2Bcustomer%40gmail.com  

however when print $_REQUEST it gives me following output:

external^customer%40gmail.com /* console output */  

I want output like that:

external%2Bcustomer%40gmail.com  

please help me on this

like image 907
Mark Martin Avatar asked May 11 '26 03:05

Mark Martin


1 Answers

If you want output exact as it is passed in URL, try this:

print_r(urlencode($_REQUEST['email']));

$_REQUEST is automatically decoded, so you need to encode it again.

like image 143
Peter Krejci Avatar answered May 13 '26 17:05

Peter Krejci