allow_url_fopen , which is required if you want to open a remote file with fopen , can be disabled; therefore, situations arise where fopen('http://...') not possible. Note: in this answer I say " fopen ", but in the same way with all the PHP functions that can access remote files: fopen , file_get_contents , simplexml_load_file , ...
Curl , on the other hand, is an extension and is not always included.
One nice thing with curl is that it is fairly easy to configure, and there are many existing options (see curl_setopt )
To set up the fopen method of accessing remote files is a bit more complicated - you usually have to work with streams (see here , for example); and, generally speaking, there are more people who know curl than they develop the development of flows.
The safest way - especially if your application is deployed to servers on which you are not an administrator, and cannot reconfigure:
- Try one solution.
- And if it doesnβt work, try another
source share