Code advice?

software development

#1

Hello all.

What I want to do is make a download.php that works like this:

download.php?id=IDNUMBERHERE&name=NAMEHERE

and it will take http://someotherserver/video?id=IDNUMBER and force the client to download it as NAMEHERE.

I used to do this like so:

header(‘Content-disposition: attachment; filename=’.$_GET[name]);
header(“Content-Type: application/force-download”);
readfile(‘http://74.125.10.31/get_video?video_id=’.$_GET[id]);

I would make a link like download.php?id=1234&name=movie.flv and when a user clicked it it would prompt them to download movie.flv which was really the file with the right ID on the other site.

As you know dreamhostdoesn’t allow readfile, and unfortunatally, cURL downloads the entire file into the dreamhost server and then serves it from there, a) making things run too slow and b) wasting my bandwidth.

What else can I do to make a link of that format work?

thanks!
-Anthony