How do I record an mp3 icecast stream on my LAMP server?

I am trying to record an mp3 stream on one server (a LAMP) that is flowing from my icecast server ( another LAMP) I am also wanting to set up a web interface for the recorder that has a record and stop button. Any ideas? ( the end user starts a live icecast mp3 broadcast and goes to a web page that has a big, red record button… when he is finished he hits the big stop button and the file is saved to a directory on the server.)