[PHP] Simple function to get link and download video on Facebook


Chia sẻ với các bạn một đoạn PHP đơn giản để lấy link download video trên Facebook.

<?php
/**
* @name Simple function to get link and download video on Facebook
* @author Juno_okyo & Killer
* @copyright 2013 by J2TeaM
*/

$url = 'https://www.facebook.com/photo.php?v=464181973622841&set=vb.405529542805619&type=3';

_Download($url);

function _Download($url) {
$useragent = 'Mozilla/5.0 (Linux; U; Android 2.3.3; de-de; HTC Desire Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$source = curl_exec($ch);
curl_close($ch);

$download = explode('/video_redirect/?src=', $source);
$download = explode('&amp', $download[1]);
$download = rawurldecode($download[0]);
header('Location: ' . $download);
exit();
}
?>

Các bạn có thể thêm một đoạn GET để có thể download theo dạng ?url=LINK_VIDEO.
Share on Google Plus

About NHOCLAK DJ

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 nhận xét:

Đăng nhận xét