readfile does not execute code on your server, so there is no problem.
However, some strange people may use your server to execute web requests to cause problems with your server by making unauthorized requests or causing an overload, so you might want to take this into account when encoding this type of function.
according to the manual, it seems that if I want to use the url with readfile, I need to enable fopen wrappers
Yes, you need to make sure allow_url_fopen is enabled. if not, you will have to learn cURL .
source share