#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Question Php Downloding


    Is it possible to download and extract a zip file from a url to my server using php script..
    the download to the folder where the php file is placed..

    with regards,
    TIttu Varghese
    IEEE
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,965
    Rep Power
    9397
    Yes, but it's not very easy. Or rather it's easier doing it someplace else. Like a bash command: pipe wget or curl into unzip.
  4. #3
  5. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4123
    Yes

    If you're on *nix system then it's probably even easier.

    File_get_contents will get the contents of a file, which you can save to another file if you wish with file_put_contents

    Php then has various zip functions - look in the manual

    If on the command line, you can do

    wget http://URL-of-file.com/file.zip

    unzip file.zip -d extract/location


    Then you can use exec to run these commands from php
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]

IMN logo majestic logo threadwatch logo seochat tools logo