I want to extract a .cbr archive (digital comics format) content with a php script. I searched for a php method to unzip archive and the simpliest I found is the ZipArchive. I know (maybe is incorrect) that the way for converting from cbr to zip is simply renaming the archive file. Although WinRar can open it, the script doesn't work. Any suggestions?
<?php
rename("comic.cbr", "comic.zip");
$path = "comic.zip";
$zip = new ZipArchive;
if ($zip->open($path) === true) {
for($i = 0; $i < $zip->numFiles; $i++) {
$zip->extractTo('.', array($zip->getNameIndex($i)));
}
$zip->close();
}
?>