Extracting Zip files with Php

Associate
Joined
13 Nov 2003
Posts
1,567
Location
Manchester
Hi All

I need to use PHP to extract a zip file as part of a cron job.

I have found this code on the PHP site - http://uk.php.net/manual/en/function.ziparchive-open.php

Code:
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip')
if ($res === TRUE) {
   echo 'ok';
   $zip->extractTo('test');
   $zip->close();
} else {
   echo 'failed, code:' . $res;
}
?>

Not too sure how it works though. I just want to extract a zip file to a directory. Can anyone advise how i would do that?

Thanks in advance
Aaron
 
No, I get this error


Parse error: parse error, unexpected T_IF in C:\Inetpub\wwwroot\development\proccess_ingram.php on line 25


Line 25 is
Code:
if ($res === TRUE) {

Thanks
 
Back
Top Bottom