-
Notifications
You must be signed in to change notification settings - Fork 23
/
core.php
71 lines (68 loc) · 2.01 KB
/
core.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
function curl($url) {
$ch = @curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$head[] = "Connection: keep-alive";
$head[] = "Keep-Alive: 300";
$head[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$head[] = "Accept-Language: en-us,en;q=0.5";
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36');
curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
$page = curl_exec($ch);
curl_close($ch);
return $page;
}
function linkHD($data) {
if (preg_match('/hd_src_no_ratelimit:"([^"]+)"/', $data, $result)) {
return $result[1];
} else {
return;
}
}
function linkSD($data) {
if (preg_match('/sd_src_no_ratelimit:"([^"]+)"/', $data, $result)) {
return $result[1];
} else {
return;
}
}
function facebookstream($link) {
$fetch = curl($link);
$resHD = linkHD($fetch);
$resSD = linkSD($fetch);
if($resHD != '') {
$source = "
{
src: '$resSD',
type: 'video/mp4',
label: 'SD',
res: 360
},
{
src: '$resHD',
type: 'video/mp4',
label: 'HD',
res: 720
}
";
return $source;
} else {
$source = "
{
src: '$resSD',
type: 'video/mp4',
label: 'SD',
res: 360
}
";
return $source;
}
}
?>