PHP - wget or fopen?

Discussion in 'Site & Server Administration' started by FunkyMonkey, Oct 29, 2007.

  1. #1
    I am coding a script to fetch large files (~100MB) off a server.

    Which is a better method of fetching the file?

    1. Through wget via shell_exec() or similar
    2. Through fopen()?
    3. Other method

    I want the best method that uses the least memory usage. At the moment, I'm thinking of the 1st option as being the best.

    Any thoughts?
     
    FunkyMonkey, Oct 29, 2007 IP
  2. ndreamer

    ndreamer Guest

    Messages:
    339
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First what are you using it for ?
    wget is great on it's own to mirror sites it can actually parse links from pages and download files.
    fopen is not to hot especially for large files, if you must use php use curl as it's much easier to use and more efficient.
     
    ndreamer, Oct 29, 2007 IP
  3. agnivo007

    agnivo007 Peon

    Messages:
    4,290
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    0
    #3
    For bigger files, wget is good.
    You can also use curl too with required options and arguments. (best option; less resource usage with php scripts)
     
    agnivo007, Oct 30, 2007 IP