. */ namespace Oreolek; class Downloader { public static function get_text($url) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $url, )); $resp = curl_exec($curl); curl_close($curl); return $resp; } public static function download($url, $outFile) { $options = array( CURLOPT_FILE => fopen($outFile, 'w'), CURLOPT_TIMEOUT => 28800, // set this to 8 hours so we dont timeout on big files CURLOPT_URL => $url ); $ch = curl_init(); curl_setopt_array($ch, $options); curl_exec($ch); curl_close($ch); } }