Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question WinZip Command Line with php

    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

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    On what kind of server shall that work? I guess Windows IIS?

    Why don't you use the standard zip extension instead? As an alternative, you can use the Archive_Tar package from PEAR.
    De gustibus non est disputandum.

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I dont know why you have to know the server? I just want to know how to use the command line in php script?

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Maybe due to the fact winzip is made for windows?

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by romram
    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, especially at the functions called exec and system. There are plenty of examples in the user comments on these manual pages.
    De gustibus non est disputandum.

  • #6
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #7
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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???
    Last edited by romram; 04-26-2004 at 08:43 AM.

  • #8
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    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
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #9
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    I see the files in the command window, but I don't see the folder were the zipped file is extracted to.

  • #10
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    -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.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #11
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...?


    Code:
    <?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>";
    ?>

  • #12
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    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)

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

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #13
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #14
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    We tried this command in Dos window and it worked fine but in PHP code it hangs
    Code:
    <?PHP			
    system('"c:\\program files\\winzip\\wzunzip" -d -o C:\\sokkit\\site\\s.zip');
    ?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •