| gan, cara download file rar pke curl gmana ? ane udah nyoba kya gini <?php function curl($url, $binary=false){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if($binary==true){ curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); } $exec = curl_exec($ch); curl_close($ch); return $exec; } function save($file, $data){ if(file_exists($file)) unlink($file); $fp = fopen($file, "x"); fwrite($fp, $data); fclose($fp); } function download(){ $file = curl("http://site.com/file.rar", true); save("file.rar", $file); } download(); ?>
file rar nya sih berhasil didownload, tpi pas dibuka error kya gini "The archive is either in unknown format or damaged" |
Tidak ada komentar:
Posting Komentar