fory Posted July 4, 2010 Share Posted July 4, 2010 Hy guys, I try to make a download script with php and I'm stuck with some code. My file looks like http://fs22.trilulilu.ro/stream.php?type=audio&source=site&hash=ab0efc23d0142b&username=remy5&key=b9bb44163ce2e0fb13d377d3d78990aed95fb824 I try this code but not seems to work <?php $file = "http://fs22.trilulilu.ro/stream.php?type=audio&source=site&hash=ab0efc23d0142b&username=remy5&key=b9bb44163ce2e0fb13d377d3d78990aed95fb824 "; if(!file) { // File doesn't exist, output error die('file not found'); } else { // Set headers header("Cache-Control: no-cache"); header("Content-Transfer-Encoding: binary"); header("Content-Disposition: attachment; filename=$file.mp3"); header('Content-type: audio/mpeg'); header("Content-Length: ".filesize($file)); header("Content-Transfer-Encoding: binary"); // Read the file from disk readfile($file); } ?> Have anyone an ideea? Help me guys. Link to comment https://forums.phpfreaks.com/topic/206683-download-streamphptypeaudio-files/ Share on other sites More sharing options...
ram4nd Posted July 5, 2010 Share Posted July 5, 2010 There is no file behind that url. Link to comment https://forums.phpfreaks.com/topic/206683-download-streamphptypeaudio-files/#findComment-1081419 Share on other sites More sharing options...
jd307 Posted July 5, 2010 Share Posted July 5, 2010 I think what you are trying to do is create a PHP script that will download a file from trilulilu.ro? I believe what your script needs is the actual file location itself (e.g. trilulilu.ro/audio/my_music.mp3) in order to work the way you are trying to do it, as at the moment that URL is just a string of information appended to URL and not a file itself. It probably uses a database to lookup the "key" or something to link it to a specific filename on their servers. If this audio file is not yours, I would check with trilulilu's terms and conditions that you are allow to download it, as I suspect you may not be allowed to. Link to comment https://forums.phpfreaks.com/topic/206683-download-streamphptypeaudio-files/#findComment-1081435 Share on other sites More sharing options...
fory Posted July 5, 2010 Author Share Posted July 5, 2010 Hy, take a look at this website : http://trilulilu-download.info/ insert a address in text box like http://www.trilulilu.ro/remy5/54b1d6a8f51b7b select .mp3 file and submit the form. Next you will see a formular like: <form method="post" name="download" action="video.php"> <input type="hidden" value="http://fs6.trilulilu.ro/stream.php?type=audio&hash=54b1d6a8f51b7b&username=remy5&key=5ee840c1e52a9cd0c09fed8c29e3cc16203f4514" name="dl"> <input type="hidden" value="audio" name="tip"> <input type="hidden" value="Dj_Andi_ft_Stella_-_Hapiness__www.remusvs11.tk_" name="nume"> <input type="submit" style="border: 1px solid rgb(0, 0, 0); padding: 10px 5px 10px 10px; font-size: 8pt; color: rgb(0, 0, 0); font-family: Tahoma; background-color: rgb(241, 241, 241); width: 120px;" value="Descarca .mp3" name="submitd"> </form> You can see what variable send that form: -an address like http://fs6.trilulilu.ro/stream.php?type=audio&hash=54b1d6a8f51b7b&username=remy5&key=5ee840c1e52a9cd0c09fed8c29e3cc16203f4514 (the same address i wand to download) -a name -and a file type to video.php where is happening the action i need. And this site is not the only who make this magic... there are many. And believe me those are not official website of trilulilu.ro.... Link to comment https://forums.phpfreaks.com/topic/206683-download-streamphptypeaudio-files/#findComment-1081473 Share on other sites More sharing options...
ram4nd Posted July 5, 2010 Share Posted July 5, 2010 Don't think that you can do that. Link to comment https://forums.phpfreaks.com/topic/206683-download-streamphptypeaudio-files/#findComment-1081562 Share on other sites More sharing options...
fory Posted July 5, 2010 Author Share Posted July 5, 2010 but i know that is not impossible.... Please someone, must be a way.... Link to comment https://forums.phpfreaks.com/topic/206683-download-streamphptypeaudio-files/#findComment-1081565 Share on other sites More sharing options...
jd307 Posted July 6, 2010 Share Posted July 6, 2010 Maybe they are using some kind of server-side functionality or software that is able to "capture" the stream. I have seen similar websites for YouTube where you can download the video. You normally have to wait a peroid of time while it "transcodes" the video before it allows you to download it. I do not really know how these sites work, but that period of time may be the server-side software extracting the video. Some of these sites also offer software to download so you can do this yourself, maybe they have a command-line functionality where you can parse the URL through it and the software grabs the data, returning the information to the web page for the user to download. But I am only speculating. Link to comment https://forums.phpfreaks.com/topic/206683-download-streamphptypeaudio-files/#findComment-1081830 Share on other sites More sharing options...
fory Posted July 6, 2010 Author Share Posted July 6, 2010 OK, I give up. thanks guys. Link to comment https://forums.phpfreaks.com/topic/206683-download-streamphptypeaudio-files/#findComment-1081941 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.