Http streaming to file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jtreg
Forum Newbie
Posts: 3
Joined: Fri Jun 18, 2010 10:38 am

Http streaming to file

Post by jtreg »

Has anyone figured out how to save a http stream to file (mp3 or ogg) _ I really want to do this on the server side... I already can save http streams using my recording software but I want to do this without having to use my (client) machine.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Http streaming to file

Post by requinix »

copy should work fine as long as the stream ends (as opposed to something like streamed radio).
jtreg
Forum Newbie
Posts: 3
Joined: Fri Jun 18, 2010 10:38 am

Re: Http streaming to file

Post by jtreg »

yes, it was streaming radio I was thinking of...
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Http streaming to file

Post by requinix »

Then try fopen+fread (which lets you limit how much data to read)+fclose.
jtreg
Forum Newbie
Posts: 3
Joined: Fri Jun 18, 2010 10:38 am

Re: Http streaming to file

Post by jtreg »

If I know how long to record for then I can use an fclose I suppose at the desired time. I suppose I have a while loop counting down then do the fclose, is there a better way?
Post Reply