Guest Posted February 15, 2009 Share Posted February 15, 2009 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 https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/ Share on other sites More sharing options...
ratcateme Posted February 15, 2009 Share Posted February 15, 2009 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 https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762517 Share on other sites More sharing options...
genericnumber1 Posted February 15, 2009 Share Posted February 15, 2009 The function is filesize not file_size(). PHP's bad function naming strikes again! Oh well. Edit: well, assuming file_size() isn't an alias for filesize(), I'm too lazy to try it myself. Link to comment https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762539 Share on other sites More sharing options...
Guest Posted February 15, 2009 Share Posted February 15, 2009 That fixed it thank you may I ask how you found that out Link to comment https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762552 Share on other sites More sharing options...
genericnumber1 Posted February 15, 2009 Share Posted February 15, 2009 If you're talking to me, http://www.php.net/ Link to comment https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762554 Share on other sites More sharing options...
Guest Posted February 15, 2009 Share Posted February 15, 2009 Oh no i meant the packet sniffer tool whats an easy one to understand and use Link to comment https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762555 Share on other sites More sharing options...
ratcateme Posted February 15, 2009 Share Posted February 15, 2009 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 https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762558 Share on other sites More sharing options...
Guest Posted February 15, 2009 Share Posted February 15, 2009 Thank you im going to give it a try and see if I cant learn a think or two. Link to comment https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762559 Share on other sites More sharing options...
genericnumber1 Posted February 15, 2009 Share Posted February 15, 2009 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 https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762565 Share on other sites More sharing options...
Guest Posted February 15, 2009 Share Posted February 15, 2009 I had no clue i could do that thanks alot that will make life so much easier. Link to comment https://forums.phpfreaks.com/topic/145255-solved-php-readfile-mp4/#findComment-762573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.