Skip to main content

Posts

Showing posts from October, 2011

Downloading a Remote File Using PHP and cURL

<?php

    function http_get_file($remote_url, $local_file)    {

        $fp = fopen($local_file, 'w');

        $cp = curl_init($remote_url);
        curl_setopt($cp, CURLOPT_FILE, $fp);

        $buffer = curl_exec($cp);

        curl_close($cp);
        fclose($fp);

        return true;
    }
?>