how to convert (in php)
http://images.example.com//images/2014/12/14-12-27-114545کریم باقری در تمرین تراکتور3 (300x200).jpg
to
Note: There are space in first URL.
I try this code but I failed:
function url_path_encode($url) {
$path = parse_url($url, PHP_URL_PATH);
if (strpos($path,'%') !== false) return $url; //avoid double encoding
else {
$encoded_path = array_map('urlencode', explode('/', $path));
return str_replace($path, implode('/', $encoded_path), $url);
}
online tools example: http://meyerweb.com/eric/tools/dencoder/