In a recent web project of mine, it was needed to offload some mp3 files to another server as per the hosting providers specifications. 😉 these could not be overidden since the service was free for a specific purpose. The database was on a different server, and as most of you know, this does not affect php a bit.
But the media bifurcation did take me for a spell. On my test bed, I was using readfile() to read the contents of the mp3file to the browser, after providing correct header tags. In the test server this was working fine, since the file urls were relative ofcourse. I checked through the hosting system using phpinfo() and did confirm the url_fopen wrappers were enabled. But to my dismay, when loaded on to the hosting space, it seemed that the readfile was failing and hence I needed a different method.
Then like a thunderbolt this idea of a file proxy class came to my mind. And this was implemented. It works for me and my project. There may be different view points, as well as enhancements. I would appreciate it if some one could enhance it in case the url_fopen wrappers is disabled in the php configuration.