4 thoughts on “file_get_contents : An Alternative to cURL Leave a comment

  1. Yeah, file_get_contents is simpler to get remote content, but not all hosts support it. It requires allow_url_fopen is turned on. So, to make sure it works, you should check it before using:

    if (ini_get(‘allow_url_fopen’)) {
    // use file_get_contents
    } else {
    // use cURL

    1. nice tip. I didn’t know that was needed to be able to use the command. Thanks for the pointer.

Leave a Reply

Your email address will not be published. Required fields are marked *