I use file_get_contents() to read remote files. It works fine with normal charactered urls, but however, a client has some files which are like
http://www.site.org/?m=sp_view_doc&file=publicpolicy/shared%20documents/therapeutic%20discovery%20project%20credit%20general%20guide.pdf
and it shows this in source code
http://www.site.org/?m=sp_view_doc&file=publicpolicy/shared%20documents/therapeutic%20discovery%20project%20credit%20general%20guide.pdf
I have tried urldecode(), but not worked. How can I avoid this problem ?
Just a simple
str_replace("&","&",$url)would work just fine.%20is perfectly ok within URLs, since it just stands for a space, so you don’t need to worry about it.