When we trying to open local or remote files with the following script. to copy local or remote files to another directory using file_get_contents() or copy() functions ,we get error for some URLs with spaces. To fix the issue we use normally replace the space with URL special characters. Below is the PHP snippet to fix the issue.
$url = "http://ccl.in/images/gallery/chennai/chennai-ccl-1 (69).jpg"; $url = str_replace("%3A",":",implode("/",array_map("rawurlencode",explode("/",$url)))); echo file_get_contents($url);