[thelist] check if the file is available on the other server

Kasimir K evolt at kasimir-k.fi
Tue Nov 22 07:09:54 CST 2005


Kirill Voronin scribeva in 2005-11-22 13:25:
> I have php script, which need check if the file(video stream) (i.e.
> test.wmv) is available on the other server (mms://wms03.makeni.net/).

First I think you shouldn't be using the mms: protocol - the player 
software uses that, and you are just wanting to detect if the file exists.

> $fp = @fopen("http://wms03.makeni.net/test.wmv", "r");
>  if ($fp) return true; else return false;

To find out what causes the problem you shouldn't suppress the errors 
:-) so try this without the '@'.

> I've also tried is_readable, file_exists functions but i know that they
> work  only on the same server.

I think that with PHP5 it is possible to use some URL wrappers with 
these too.

I'd probably do this with curl, see http://php.net/curl where you'll 
find some examples too. Others might prefer socket functions: 
http://php.net/sockets

.k



More information about the thelist mailing list