...

View Full Version : WinZip Command Line with php



romram
04-18-2004, 08:28 PM
Please do somebody know how to use "WinZip Command Line support Add-on" with php, how to writ a script that will extract zipped files using this facility?

please check this link:
http://www.winzip.com/wzcline.htm

mordred
04-18-2004, 09:14 PM
On what kind of server shall that work? I guess Windows IIS?

Why don't you use the standard zip extension (http://www.php.net/manual/en/ref.zip.php) instead? As an alternative, you can use the Archive_Tar (http://pear.php.net/package/Archive_Tar) package from PEAR.

romram
04-18-2004, 09:24 PM
I dont know why you have to know the server? I just want to know how to use the command line in php script?

Nightfire
04-18-2004, 10:36 PM
Maybe due to the fact winzip is made for windows?

mordred
04-19-2004, 12:49 AM
I dont know why you have to know the server?

Trust me, it's important information when you want to execute a program from the shell through PHP. So, is your server running on windows? If not, you can forget calling the winzip through the command line.

I'm still baffled why you didn't answer directly that fairly simple question.


I just want to know how to use the command line in php script?

Have a look at the Program Execution Functions (http://www.php.net/manual/en/ref.exec.php), especially at the functions called exec (http://www.php.net/manual/en/function.exec.php) and system (http://www.php.net/manual/en/function.system.php). There are plenty of examples in the user comments on these manual pages.

romram
04-25-2004, 11:37 AM
Hi mordred...
it is very late, but I will tell now all the information:

Platform: Windows 2000 professional
php version:4.3.3
server:Apache 2.0

Note: I don't know how to use the command line, because I am of that generation that when his eyes opened there was only buttons and clicks... :rolleyes:

romram
04-26-2004, 09:34 AM
I used the command line like this and I get an error massege:


C:\>"c:\program files\winzip\wzzip" -v MyFile.zip
WinZip(R) Command Line Support Add-On Version 1.1 (Build 6028)
Copyright (c) WinZip Computing, Inc. 1991-2004 - All Rights Reserved

ERROR: Zip file MyFile.zip does not exist
Program is terminating!


I wrote the command in this way and I got the following massege:

C:\>wzzip -v MyFile.zip
'wzzip' is not recognized as an internal or external command,
operable program or batch file.

What happen ?? Does anybody know??? :confused: :confused: :(

firepages
04-26-2004, 10:55 AM
C:\>"c:\program files\winzip\wzzip" -v c:\path\to\MyFile.zip

unless MyFile.zip is in c:\MyFile.zip , still easier to use the path anyway

romram
04-26-2004, 11:13 PM
I see the files in the command window, but I don't see the folder were the zipped file is extracted to.

firepages
04-27-2004, 05:36 AM
-v is probably the 'view/verbose' flag e.g. showing the contents of the zipfile (or teeling you what is being done) , there will be other flags for extraction, compression etc , read the docs for a list of command flags.

romram
04-27-2004, 10:31 AM
I used the following code to unzip files using winzip command line, the command worked in the command window, but it didn't work in the code, it says that the file is unzipped but I can't see any thing...?




<?PHP
$root ='c:\\';
$unzipcmd = 'c:\>"c:\\program files\\winzip\\wzunzip" -d';

function unzip($source,$target) {
global $unzipcmd;
if (file_exists($source)) {
echo "unzipping $source to $target . . .<br>";
$cmd = $unzipcmd.' '.$source.' '.$target;
echo $cmd."<br>";
system($cmd,$return);
echo 'done. <BR>';
}
else return "File $source Not Found!<br>";
}

echo "<pre>".unzip($root."MyFile.zip","c:\\")."</pre>";
echo $root."<BR>";
?>

firepages
04-27-2004, 01:48 PM
Hi , your exec command should look something like below ..

however the unregistered/evaluation version of winzip ignores the -yb flag and requires user input , e.g you will note that from the command line you have to 'press any key' , I tried to reproduce this via popen && proc_open etc but with no joy (on windows XP)



<?
exec("C:\PROGRA~1\winzip\wzunzip -yb C:\\MyFile.zip C:\\",$return);
print_r($return);
?>

romram
04-27-2004, 06:22 PM
It worked now, but it worked once and then when try it another time the browser hangs?
it seems that the system cll taked a long time to excuete? is there any solution? :(

romram
05-08-2004, 11:29 AM
We tried this command in Dos window and it worked fine but in PHP code it hangs


<?PHP
system('"c:\\program files\\winzip\\wzunzip" -d -o C:\\sokkit\\site\\s.zip');
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum