how to read a video file placed at server in php - video file's name includes http wrapper -


I am using the following code, but the warning appears with fseek and its Instead -1 gives 0's.

  $ file = fopen ("http://www.example.com/public_html/data/video/temp.mov", "r") or exit ("Unable to open file "); Fees ($ file, -128, SEEK_END);   

The file is definitely opened but fseek does not work is there any other way to read the server from the video?

The error message is: filesize () [function.filesize]: status failure warning: fseek () [Function.fseek]: stream < / Pre>

This should be supported by some platform dependent problem: try this code:

  $ filename = "www.example.com/public_html/data/video/temp.mov"; $ File = fopen ($ filename, "r") or exit ("unable to open file"); Fseek ($ file, filesize ($ filename) - 128);   

The HTTP cover does not support asking if you want to search through a remote file via HTTP, then you need to get the size of the file. One possible way to interpret in the directory list, or to request the HEAD . When you know that you can use and filesystem

This is also a way.

How to download a file with the CRL (This example loads the data in a PHP variable, use only when you want to process the data, if you want it to be just CURLOPT_RETURNTRANSFER Instead of CURLOPT_FILE):

  $ c = curl_init (); Curl_setopt ($ c, CURLOPT_URL, "http://example.com/some_dir/some_file.ext"); Curl_setopt ($ c, CURLOPT_RANGE, max (0, $ filesize - 128). '-' Max. (0, $ filesize - 1)); Curl_setopt ($ c, CURLOPT_RETURNTRANSFER, true); $ Content = curl_exec (); Echo ($ content);    

Comments