Return to Snippet

Revision: 53268
at November 17, 2011 20:32 by kairy2k9


Updated Code
<?php
	
	// Define Filename and Download link
	$file_name = 'mediawiki-1.17.0.tar.gz';
	$download_link = 'http://download.wikimedia.org/mediawiki/1.17/mediawiki-1.17.0.tar.gz';
	
	// Download File Content
	$file_data = file_get_contents($download_link);

	// Create File
	$handle = fopen($file_name, 'w');
	fclose($handle);
	
	// Save Content to file
	$downloaded = file_put_contents($file_name, $file_data);
	if($downloaded > 0)
	{
		echo 'Datei wurde erfolgreich heruntergeladen!<br>';
	}

	exec('tar xfvz '. $file_name, $extract);
	
	if($extract > 0)
	{
		echo 'Datei wurde entpackt';
	}
	
?>

Revision: 53267
at November 17, 2011 20:27 by kairy2k9


Initial Code
<?php
	
	// Define Filename and Download link
	$file_name = 'mediawiki-1.17.0.tar.gz';
	$download_link = 'http://download.wikimedia.org/mediawiki/1.17/mediawiki-1.17.0.tar.gz';
	
	// Download File Content
	$file_data = file_get_contents($download_link);

	// Create File
	$handle = fopen($file_name, 'w');
	fclose($handle);
	
	// Save Content to file
	$downloaded = file_put_contents($file_name, $file_data);
	if($downloaded > 0)
	{
		echo 'Datei wurde erfolgreich heruntergeladen!';
	}
	
?>

Initial URL

                                

Initial Description

                                

Initial Title
File Download (with file_put_contents)

Initial Tags
file, download

Initial Language
PHP