I've implemented code that sends a one-time link to a smartphone. When the user clicks the temporary link an MP3 will be sent to the phone to be used as a ringtone. My code thus finds the one-time code in the database table, then "streams" the MP3 to the phone, then deletes the one-time code from the database table. Below is the central part of the "streaming".
while(!feof($file))
{
print(@fread($file, 1024*8));
ob_flush();
flush();
}
It basically works on smartphones, but not on iPhones. (I know, iPhones can't use MP3:s as ringtones. But it can be transformed to a ringtone.) However, it seems that (any) smartphone will call the link several times, probably some kind of pre-load, creating statistical doubles in my databases. For iPhone it doesn't work at all because the one-time code is deleted in the pre-load (?) If I remove the deleting of the one-time code it works on iPhones.
Also, I've tried it on some smartphones but sometimes the MP3 ends up just anywhere on the phone. Is it possible for the user to control where to store it somewhow? Do I need to code that?
Basically, my questions is: I want to send an MP3 to a smartphone when a one-time link is clicked on the smartphone and then delete the one-time code.