Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download a Facebook Video (.mp4) via PHP

So for example I have this URL:

http://video.ak.fbcdn.net/hvideo-ak-prn2/v/1032822_578813298845318_1606611618_n.mp4?oh=c3c6a02985213f7c47386f4653792ca6&oe=5200506F&__gda__=1375798216_02752679a44bc4b3c514bee21e000959

How can I download the video source file via PHP?

Note that downloading the URL will not give me the video source!

// does not work:
file_put_contents('video.mp4', 'http://video.ak.fbcdn.net/hvideo-ak-prn2/v/1032822_578813298845318_1606611618_n.mp4?oh=c3c6a02985213f7c47386f4653792ca6&oe=5200506F&__gda__=1375798216_02752679a44bc4b3c514bee21e000959');      
// this does not download the video source but instead gets me a file that links to the video hosted on Facebook.
like image 423
Jonas Kaufmann Avatar asked Mar 22 '23 22:03

Jonas Kaufmann


1 Answers

file_put_contents('derp.mp4', file_get_contents('http://video.ak.fbcdn.net/hvideo-ak-prn2/v/1032822_578813298845318_1606611618_n.mp4?oh=c3c6a02985213f7c47386f4653792ca6&oe=5200506F&__gda__=1375798216_02752679a44bc4b3c514bee21e000959'));

like image 63
Elpy Avatar answered Apr 01 '23 06:04

Elpy