limiting download when using cURL

Discussion in 'PHP' started by gio, Oct 6, 2009.

  1. #1
    hi,

    is there a way to limit the download size when using curl? i just want to get the first 1024 bytes of the url I'm downloading.

    thanks in advance.
     
    Last edited: Oct 6, 2009
    gio, Oct 6, 2009 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    I don't think there is a way. For your purpose, I would advise using fsockopen instead.
     
    ThePHPMaster, Oct 6, 2009 IP
  3. gio

    gio Well-Known Member

    Messages:
    2,390
    Likes Received:
    162
    Best Answers:
    0
    Trophy Points:
    195
    #3
    i found the solution.

    curl_setopt($ch, CURLOPT_RANGE, "0-1024");

     
    gio, Oct 7, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yeah gio that should work but you should also know that sometimes servers ignore this. This is a feature that the server you are requesting a file from should support.
     
    premiumscripts, Oct 8, 2009 IP