PHP Classes

File: updater.php

Recommend this page to a friend!
  Classes of Kemal GENIS   PHP Video Downloader Script   updater.php   Download  
File: updater.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Video Downloader Script
Discover and download a video using its page URL
Author: By
Last change:
Date: 5 years ago
Size: 751 bytes
 

Contents

Class file image Download
<?php
# Updater Version: 1.0
function download($source, $save){
   
file_put_contents($save, fopen($source, 'r'));
    if(
file_exists($save) and filesize($save) > 0){
        return
true;
    }
    else{
       
unlink($save);
        return
false;
    }
}
if(!
is_writable("./")){
    echo
"Lütfen ".dirname("./")." dizinine 0777 yetkisi veriniz.";
}
if(
download("http://www.manyetix.com/update.zip", "./update.zip")){
   
$zip = new ZipArchive;
    if (
$zip->open('./update.zip') === TRUE) {
       
$zip->extractTo('./');
       
$zip->close();
       
//echo '<span style="color:green;">Update Success!</span>';
   
} else {
       
//echo '<span style="color:red;">Update Error!</span>';
   
}
   
unlink("./update.zip");
}
else{
   
//echo '<span style="color:red;">Update Download Error!</span>';
}
header("Location:./");