static function downloadToTempfile($url) {
        $download_path = Files::getTempFilename();
        $fp = fopen($download_path, 'w+');
        fwrite($fp, file_get_contents($url));
        fclose($fp);
        return $download_path;
    }