Jump to content

Downloading a wmv file in a PHP program


ocpaul20

Recommended Posts

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

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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. :-)

Link to comment
Share on other sites

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).

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.