function download() { $this->count = 0; // //Download file information // Basic::printToConsole('Downloading file information: ', false); $filecheck = new CheckURL(); //Create a new object $filecheck->downloadHeaders($this->path); //Download headers from a URL $filecheck->lastModified(); //Run the function that finds when the URL(document) was last modified. $filecheck->contentLenght(); //Run the function that finds content lenght $filesize = round($filecheck->content_lenght / 1024); //Create a variable filesize Basic::printToConsole('DOWNLOADED', false); $this->frequency = 100; //Set the frequency Basic::printToConsole("\nThe script is downloading " . $this->path . "\nThe file is downloaded with " . $this->downloadSpeed . " KB/s\nSize of the file is: {$filesize} KB\nThe DMOZ data dumps were last updated: " . $filecheck->last_modified . "\n\nDownloading please wait"); //Open the url of the structure rdf file if (!($file = fopen($this->path, "r"))) { basic::error('Fatal error', 'I/O error! Could not download the file'); } //Open the file we write to if (!($openfile = fopen($this->filename . ".u8.gz", 'w'))) { basic::error('Fatal error', 'Cannot open the file (' . $this->filename . '.u8.gz)'); } //Write the data while ($data = fread($file, round(DOWNLOAD_SPEED * 1024))) { if (!fwrite($openfile, $data)) { basic::error('Fatal error', 'Cannot write to file ' . $this->filename . ''); } //Don't write the dot every time $this->PrintDot(); } fclose($file); fclose($openfile); Basic::printToConsole("\n\n " . strtoupper($this->filename) . ".U8.GZ WAS SUCCESSFUL DOWNLOADED \n Download URL: " . $this->path . "\n"); }