-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmediafire.php
35 lines (28 loc) · 875 Bytes
/
mediafire.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
<?php
/*
Version: 1.2.2
Author: HKLCF
Copyright: HKLCF
Last Modified: 11/01/2019
*/
$url = isset($_GET['url']) ? htmlspecialchars($_GET['url']) : null;
$support_domain = 'www.mediafire.com';
if(empty($url)) {
$url = 'http://www.mediafire.com/file/8x5ol3r8wpb477a/small.mp4'; // sample link
}
if($url) {
preg_match('@^(?:http.?://)?([^/]+)@i', $url, $matches);
$host = $matches[1];
if($host != $support_domain) {
echo 'Please input a valid mediafire url.';
exit;
}
}
$result = file_get_contents($url, false, stream_context_create(['socket' => ['bindto' => '0:0']])); // force IPv4
preg_match('/aria-label="Download file"\n.+href="(.*)"/', $result, $matches);
$result = urldecode($matches[1]);
$output = [];
$output[] = ['label' => 'Original', 'file' => $result, 'type' => 'video/mp4'];
$output = json_encode($output);
echo $output;
?>