Results 1 to 3 of 3

Thread: Stream music from .php

  1. #1
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation Stream music from .php

    Hi guys i just fond out that http://www.dnbradio.com was able to get there radio station streaming on iphones
    http://www.dnbradio.com/iphone/ and it works, they are using a PHP

    take a listen to there stream
    http://www.dnbradio.com/iphone/strea....com&port=9050

    more information @ http://blog.fuexy.com/2007/12/02/sho...one-continued/
    What i am wondering is HOW, can any one help.

    Thank you
    The web in one word.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Well, the details aren't clear to me, and I'm not sure where you can find the information on them, but the basic answer is that by sending out header data setting any sort of file, you can then output any file you'd like. A content-type header can set the data as html (this is the default, so no need to do so), an image, a text document, or really anything else you'd want.

    So-- 1. figure out the right content-type header; 2. simply stream the content through the page. readfile($path) will just grab the contents of $path and output them directly to the user. That's the most basic.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    this is what i have however its not working

    Code:
    <?php
    $filename = "http://queersperm.com:8080";
    $filesize = filesize($filename);
    $mime_type = 'audio/mpeg';
    
    header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
    header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, private, must-revalidate, max-
    age=0");
    header("Pragma: no-cache");
    header('Content-Length: '.$filesize);
    header('Content-Type: '.$mime_type);
    header('Content-Disposition: attachment;
    filename="'.basename($filename).'"');
    
    $fp = fopen($filename,"r");
    while (!feof($fp)) {
            echo fread($fp, 8192);
    }
    fclose($fp);
    ?>
    The web in one word.

Bookmarks

Posting Permissions

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