public function testSaveUrl() { $tmpdir = tmpdir(); mkdir($tmpdir); saveUrl('http://www.google.com', "{$tmpdir}/google.html"); $this->assertFileExists("{$tmpdir}/google.html"); $this->assertContains('html', strtolower(file_get_contents("{$tmpdir}/google.html"))); }
/** * This downloads a single file. * * @param string $url The URL to fetch. * @param string $filename The absolute file name to save to. * * @return void */ private function _downloadFile($url, $filename) { $dirname = dirname($filename); if (!is_dir($dirname)) { mkdir($dirname, 0777, true); } saveUrl($url, $filename); }