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
    }

Leave a Reply

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