Although all the three functions read resources, their respective application scenarios are different.
Curl is mostly used to capture web pages on the Internet, fopen is mostly used to read files, while file_get_contents is mostly used to obtain static page content.
1. fopen/file_get_contents each request will re-query the DNS and will not cache the DNS information. However, curl automatically caches DNS information. Only one DNS query is required for a webpage or image request under the same domain name. This greatly reduces the number of DNS queries. Therefore, curl performance is much better than fopen/file_get_contents.
2. When requesting HTTP, fopen/file_get_contents uses http_fopen_wrapper instead of keeplive. But curl does. In this way, curl is more efficient when multiple links are requested.
3. Curl can simulate multiple requests, such as post data and form submission. You can customize the requests as needed. Fopen/file_get_contents can only get data.
File_get_content, curl, and fopen are most efficient.