Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cdowebcast/0342d89e180451a009a4bea3496f7270 to your computer and use it in GitHub Desktop.
Save cdowebcast/0342d89e180451a009a4bea3496f7270 to your computer and use it in GitHub Desktop.

Revisions

  1. @jesseleite jesseleite revised this gist Aug 8, 2013. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions file_get_contents_curl.php
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    // cURL replacement for file_get_contents()
    // Safer alternative to enabling allow_url_fopen in php.ini :)

    function file_get_contents_curl($url) {
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);

    $data = curl_exec($ch);
    curl_close($ch);

    return $data;
    }
  2. @jesseleite jesseleite renamed this gist Aug 8, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @Awea Awea created this gist Aug 27, 2012.
    12 changes: 12 additions & 0 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    function file_get_contents_curl($url) {
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
    curl_setopt($ch, CURLOPT_URL, $url);

    $data = curl_exec($ch);
    curl_close($ch);

    return $data;
    }