Jump to content

[SOLVED] PHP Readfile MP4


Guest

Recommended Posts

I am trying to read through a mp4 file and it works perfectly fine if i directly link to it

http://www.usualbeings.com/editor/95.mp4

but if i use the php function readfile it doesnt work at all

http://www.usualbeings.com/watchvideo/18395.mp4

 

I have tried every sort of combination of these headers but cant seem to find somthing that will work

header('Content-type: video/mp4');
header('Content-type: video/mpeg');
header('Content-disposition: inline');
header("Content-Transfer-Encoding:­ binary");
header("Content-Length: ".file_size($file));

Link to comment
Share on other sites

a quick packet sniff reveals

HTTP/1.1 200 OK
Date: Sun, 15 Feb 2009 03:59:17 GMT
Server: Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4.1 with Suhosin-Patch mod_perl/2.0.4 Perl/v5.10.0
X-Powered-By: PHP/5.2.6-2ubuntu4.1
Content-Length: 125
Keep-Alive: timeout=10, max=100
Connection: Keep-Alive
Content-Type: video/mp4
Content-Language: en-US

<br />
<b>Fatal error</b>:  Call to undefined function file_size() in <b>/var/www/watchvideo.php</b> on line <b>32</b><br />

not sure but looks like you host has disabled file_size()

 

Scott.

 

Link to comment
Share on other sites

i use wireshark i have done a lot of network programming in java and found it use full for debugging  that it is also use full for finding http headers and also in case like that one you can use it to get all the html that is sent even though you cannot see it because quick time loads

 

Scott.

Link to comment
Share on other sites

You don't need to use wireshark, or packet sniffing at all.

 

Open up a command console and type this:

 

telnet www.usualbeings.com 80

 

hit enter then type this...

 

HEAD /watchvideo/18395.mp4 HTTP/1.1

Host: www.usualbeings.com

 

and then hit enter twice.. it should give you all of the headers from the request. If you want the content of the request instead of just the headers, replace HEAD with GET - everything else is the same. I only said to use HEAD because it will display the contents of the file (which is very large and will download in your terminal window).

 

raw requests like the above are very nice for diagnosing server and header problems such as these.

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.