ocpaul20 Posted December 26, 2011 Share Posted December 26, 2011 I wonder if some kind-hearted person can help me? I am trying to download a video file which has a wmv. The protocol is either mms:// or http:// I can see the video in my browser but I cannot download it using curl or wget in a program and I need to download a few of these. They are publicly viewable so they are not private stuff. The URL is http://210.150.12.140/vod11/tepco/other/1111_01.wmv?MSWMExt=.asf or mms://wmt.stream.co.jp/vod11/tepco/other/1111_01.wmv All I get at the moment is a text file of less than 1K and not the movie itself. How would I download this file please? Thanks Paul Quote Link to comment https://forums.phpfreaks.com/topic/253828-downloading-a-wmv-file-in-a-php-program/ Share on other sites More sharing options...
kicken Posted December 26, 2011 Share Posted December 26, 2011 You'll need to find something that can access the videos over the given protocol. I'm not aware of any php classes or extensions off hand that would handle it. As for the mms:// url's, you could use VLC to download it to a file. Build the appropriate command line, then use exec to run vlc which will then download the video. Ex: $url = 'mms://wmt.stream.co.jp/vod11/tepco/other/1111_01.wmv'; $file = basename($url); $sout = sprintf('#standard{access=file,dst=%s}', $file); $cmd = sprintf('cvlc %s --sout=%s', escapeshellarg($url), escapeshellarg($sout)); exec($cmd); Quote Link to comment https://forums.phpfreaks.com/topic/253828-downloading-a-wmv-file-in-a-php-program/#findComment-1301304 Share on other sites More sharing options...
ocpaul20 Posted December 26, 2011 Author Share Posted December 26, 2011 OK, thanks kicken, but the http protocol can be read in php (just like in a browser) and the video file itself could be downloaded, couldn't it? There must be some way to access the final movie file which is being accessed by the browser? Quote Link to comment https://forums.phpfreaks.com/topic/253828-downloading-a-wmv-file-in-a-php-program/#findComment-1301307 Share on other sites More sharing options...
kicken Posted December 26, 2011 Share Posted December 26, 2011 but the http protocol can be read in php (just like in a browser) It's not just the HTTP protocol. There's another media protocol being used on top of it. Near as I can tell, it's MMSH. If you read up on it and figure out how it works you could probably write some php code to download the file. Quote Link to comment https://forums.phpfreaks.com/topic/253828-downloading-a-wmv-file-in-a-php-program/#findComment-1301312 Share on other sites More sharing options...
ocpaul20 Posted December 26, 2011 Author Share Posted December 26, 2011 Maybe I dont understand this protocol thing well enough, but the movie is a file on disk so why can't I read that and download it as a binary stream of bytes and save it to my disk? I dont want to interpret the file (which is where I think the protocol would come into the equation) as I already have media players on my machine which can do that. :-) Quote Link to comment https://forums.phpfreaks.com/topic/253828-downloading-a-wmv-file-in-a-php-program/#findComment-1301314 Share on other sites More sharing options...
kicken Posted December 26, 2011 Share Posted December 26, 2011 Maybe I dont understand this protocol thing well enough, but the movie is a file on disk so why can't I read that and download it as a binary stream of bytes and save it to my disk? You need to know the proper protocol to communicate with the remote server and properly request the movie file you want. As you've already seen, a standard http request doesn't work, you just get back a text file. I only spent about 5 minutes looking at the exchange between the server and vlc when loading that url, but there seems to be specific headers and values you have to send. VLC shows it as an mmsh:// url so if you read about that protocol you can learn how to implement it (or maybe find an existing solution). Quote Link to comment https://forums.phpfreaks.com/topic/253828-downloading-a-wmv-file-in-a-php-program/#findComment-1301319 Share on other sites More sharing options...
ocpaul20 Posted December 26, 2011 Author Share Posted December 26, 2011 OK, thanks for explaining. Quote Link to comment https://forums.phpfreaks.com/topic/253828-downloading-a-wmv-file-in-a-php-program/#findComment-1301325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.