Urlencode i file_get_contents
Mamy adres urlhttp://site.s3.amazonaws.com/images/some image @name.jpg
wewnątrz$string
Co próbuję zrobić (tak, wokół adresu URL znajduje się spacja):
$string = urlencode(trim($string));
$string_data = file_get_contents($string);
Co otrzymuję (@ jest również zastąpione):
file_get_contents(http%3A%2F%2Fsite.s3.amazonaws.com%2Fimages%[email protected])[function.file-get-contents]: failed to open stream: No such file or directory
Jeśli skopiujesz / wkleiszhttp://site.s3.amazonaws.com/images/some image @name.jpg
w pasku adresu przeglądarki otworzy się obraz.
Co jest złe i jak to naprawić?