I am trying to get images from a remote server using file_get_contents
. The image URL may contain spaces and / or special characters, such as Γ½, Γ‘, Γ, etc., And when it performs an operation with HTTP code 400 - Bad Request. If I try to encode the url (or segments of this URL) using urlencode
or rawurlencode
, I get 404.
If the image URL does not contain spaces or special characters, it loads without problems.
I have a hunch that this has something to do with coding, but I just can't figure it out. Is there a coding method that I am missing? Is there a header that needs to be set for the request?
source share