readfile In Parts

Discussion in 'PHP' started by vOlLvEriNe, Apr 5, 2014.

  1. #1
    Hi All,
    How Can I Use readfile or any other function to stream or download the file in parts,
    I Want This, (A Boy Use Youtube Videos to play it from there server)
    Capture.PNG
    Instead of (Its Mine, I'm Using same, But want to divide)
    Capture2.PNG

    Please help me
    Thanks
     
    vOlLvEriNe, Apr 5, 2014 IP
  2. vOlLvEriNe

    vOlLvEriNe Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    vOlLvEriNe, Apr 6, 2014 IP
  3. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #3
    What language is this? What software is this?

    The above image looks similar to torrent downloading, or streaming that allows start position request.
     
    ThePHPMaster, Apr 6, 2014 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #4
    Pretty much @ThePHPMaster has it right in that you aren't really giving us enough information to come up with an answer. The data source is going to be the be-all end-all of this question...

    Though multipart requests as a single operation are completely outside what PHP is capable of/used for, so I'm not certain that your question makes the least bit of sense in the first place. readFile and most file get functions for php aren't designed to 'update the user while continuing' which is the type of thing your screenshot is showing -- unless you set it up to "AJAX stream" where you request a piece at every ajax request so it can update the progress; but that's usually a convoluted mess that unless you REALLY know what you are doing treads into "this has no business on a website" territory.
     
    deathshadow, Apr 6, 2014 IP
  5. vOlLvEriNe

    vOlLvEriNe Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    I'm Using Custom php,
    $url = 'http://site.com/file.mp4';
    header('Content-Type: video/mp4');
    header('Content-Disposition: video.mp4' );
    readfile($url);
    
    PHP:
    When I Open This, It Provide Me A File, But It Sends Single Request, I Want Multiple Request As First Image Shows.
     
    vOlLvEriNe, Apr 6, 2014 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #6
    Doesn't make any sense, you're wrapping a file for no reason and using PHP in this manner has jack to do with multipart streaming. You are basically asking for something it takes specialized server software like FFmpeg to do. This is NOT something you use PHP to control; nor is it capable of it.
     
    deathshadow, Apr 6, 2014 IP
  7. vOlLvEriNe

    vOlLvEriNe Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #7
    @deathshadow Its A Reason to wrapping file, I'm fetching videos link from youtube, thats are like this
    http:// s4---googlevideo.com/?s=4&exp=19.58.14 Etc Etc, Its A Big Url, So I'm Wrapping file give it short link
     
    vOlLvEriNe, Apr 6, 2014 IP
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #8
    Ah... so the answer is to not do that. :D

    Doctor, doctor, it hurts when I do this...

    As a rule of thumb I say don't use shortlinks; I don't like them as they obfuscate where the link is actually going. Only reason to use them I could ever justify is to get around signature character limits on forums (which are really stupid when they count stuff inside tags... hint, hint DP)... other than that, my advice is pretty much don't use them.

    Though that the devil are you doing that results in such a rat**** bat**** insane URI for a youtube video?!?
     
    deathshadow, Apr 6, 2014 IP
  9. vOlLvEriNe

    vOlLvEriNe Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #9
    :oops:
     
    vOlLvEriNe, Apr 6, 2014 IP