PHP
URLENCODE VS RAWURLENCODE IN PHP
ENCODE FILE PATH OF URL http://site.com/my path/my@+%pic.jpg http://site.com/my%20path/my%40%2B%25pic.jpg
RAW URL ENCODE (A)
01
$url = "http://site.com/"; $url .= rawurlencode("my path") . "/"; $url .= rawurlencode("my@+%pic.jpg");
RAW URL ENCODE (B)
02
* Non-alphanumeric characters replaced with percent sign (%) followed by corresponding hex code.
* Dash, underscore, period, tilde (-_.~) are not replaced.
* White spaces replaced with %20.
ENCODE QUERY STRING http://site.com/api ?email=jon@doe.com http://site.com/api ?email=jon%40doe.com
URL ENCODE (A)
03
$url = "http://site.com/api?"; $url .= urlencode("email") . "="; $url .= urlencode("jon@doe.com");
URL ENCODE (B)
04
* Non-alphanumeric characters replaced with percent sign (%) followed by corresponding hex code.
* Dash, underscore, period (-_.) are not replaced.
* White spaces replaced with +.