Forum Moderators: buckworks

Message Too Old, No Replies

selling downloads of mp3's

not sure how to do this

         

Trisha

7:56 pm on Mar 3, 2003 (gmt 0)

10+ Year Member



I have a client who has a band and they want to sell their mp3's through their site. Preferably with a choice as either single mp3's or all the mp's on the cd. They don't have a merchant account at this time and are not yet ready for one yet. Paypal and/or maybe something like propay would have to be used for taking the payments. I've set up Mals cart a few times and it would probably be best for this also.

What I don't know how to do is set up the actual page for them to download from. It can't be something anyone could access once they know the url, for obvious reasons. If, once they pay, a password is made available to them, they could just give the password to someone else. Unless some other scripting is used to assign each purchase its own password. That is not something I know how to do though. And how do you handle situations where a person tries but is unable to download the files successfully in a given time frame?

Maybe I'm making this more difficult than it should be, or maybe it really is more difficult than it seems.

Has anyone had experience with this? Are there scripts already available? I though about doing a search for a script for this, but really didn't know what search terms to use - I don't really know what it would be called.

Thanks, I would appreciate any help with this.

hakre

8:07 pm on Mar 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi Trisha,

that's really an interesting question. i would create an application that serves the mp3 file. this application needs a access rule (verify that the download is paid) and serves the file only once completely. if the download interrupts, this does not count. if the download completes, then it times out. to prevent people from stealing parts of an mp3 (because you can stream them, ie you don't need to completly download), i would zip the files.

shrewsbury matt

8:09 pm on Mar 3, 2003 (gmt 0)

10+ Year Member



OScommerce has a module that allows you to charge for downloads. You could hook it up to Paypal for a completely free solution.

jatar_k

8:15 pm on Mar 3, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hakre's suggestions are solid. You should be able to do this easily enough, the zipping is a good idea to keep them from streaming, didn't think of that on first read.

Now you just need to figure out what scripting languages are available on the host and start looking for "[language] download scripts" or something like that.

You will still have to tweak it a bit after that I would imagine. What kind of return code do they send once they've paid? Maybe you could use that for the original access then proceed as hakre suggested.

Trisha

8:26 pm on Mar 3, 2003 (gmt 0)

10+ Year Member



I've used oscommerce before, but didn't realize they had a download module for it. I really didn't want to have to go to that much trouble, setting up oscommerce, for this site. I'm not sure how much the client will be able to pay. Of course, it that is what it takes they will have to pay me what I need for me to do it.

hakre's suggestion sounds great, doesn't sound that easy to me though. Php is available, and is what I would prefer to use, although a perl cgi solution would be fine too.

I will try searching for 'php download scripts' as was suggested. All I could think of before was to search for 'mp3 download software', which I'm pretty certain wouldn't give me what I want.

grifter

2:20 am on Mar 4, 2003 (gmt 0)

10+ Year Member



Perhaps you could search for "php download manager."

You could use PHP to track sessions, and pass files through PHP to authenticated users...try searches for "php passthrough" also. You'll probably have to be mindful of the PHP timeout value set in php.ini so downloads don't cut off prematurely.

Another option is to run a cron that uses temporary symbolic links to give users an URL that lasts a day, say:

[yoursite.com...]

and use cron to remove those symlinks when the download time limit window closes.

hakre

3:49 am on Mar 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



grifter noticed some good points:

  • passthrough
    i won't name it passthrough (which is a php function on it's own), i would just open the file, read it in with a buffer (1kb - 1024 bytes) and output it. if the download stops (client disconnects), this has to be catched by the script. see connection_aborted() [php.net] and the there linked connection handling doc for more info.
    keep in mind if you use php as cgi, to flush() [php.net] the content after each buffer output.
  • script timeout
    give your script enough time to output the buffer to the client. you can increase script timout each time the buffer has been send (flush etc.) by using the set_time_limit() [php.net] directive.
  • session handling
    session handling can be used to determine wether the user has paid for a specific download or not. you should limit the download to the ip-adress of the remote host the user used while logging in and paying the download. this will prevent others to spoof the session. to add an extra layer of security you can also implement it all on https.

grifter

4:26 am on Mar 4, 2003 (gmt 0)

10+ Year Member



Thanks for elaborating, hakre.

I once served up PDF through PHP, and it worked pretty well. Make sure if you go this route that you test on various browsers and platforms. I had to test for browser and serve different headers if I recall correctly, between IE 5.5 and 6 (it was a while ago).

hakre

4:36 am on Mar 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yeah grifter, you name it. again one point. i don't wanted to mention it, because ie can really drive you nuts in that case. but someone here in this forum already posted workaround ;). and it's only one point which can be easily solved, because providing a zip file is not that hard like .mp3 or .pdf.

Trisha

11:28 pm on Mar 7, 2003 (gmt 0)

10+ Year Member



grifter, hakre - your suggestions sound great but are not something I'm capable of doing. And I doubt that I will get paid enough to make it worth it for me to learn everything you've suggested.

I briefly searched google, but didn't see anything like what I'm looking for.

I think I have two options:

1 - oscommerce, I found a thread on their message board about how to set something like this up with it. They have a stable version of 2.2 out now, which I've been waiting for for a while. It may be fun to play with too.

2 - the client sent me a link to a site who has something like this set up. I sent an email to the webmaster asking how it was done. Maybe they can tell me what script they are using or can send me in the direction of the person who did it for them.

The oscommerce option looks more likely to be the one I'll be using.

Thanks for all your help!