One of the more common PHP functions developers use in order to make remote requests is file_get_contents
. The function makes it easy to send requests to another URL and then handle the response.
It’s especially handy if you need to make an Ajax request to another site but aren’t allowed to do so from the client-side because of cross-site-scripting.
That said, cURL is often a better option than file_get_contents because it gives you far more control over the options that are set when setting up the request to be made. file_get_contents
simply doesn’t do that. Instead, it provides enough options for making simple GET
requests.

No, not that kind of curl.
For these reasons, it’s often a good idea to use cURL when you need to provide a more fine-tuned request. Even more so, it’s helpful to have all of the functionality wrapped up in a utility function you can drop in your project whenever you need it.