-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
45 lines (44 loc) · 1.14 KB
/
index.php
File metadata and controls
45 lines (44 loc) · 1.14 KB
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
<?php
$file = $_GET['file'];
$uk = $_GET['uk'];
$shareid = $_GET['shareid'];
//get url
if ($file != '') {
//get url
$url = 'http://pan.baidu.com/s/' . $file;
$src = file_get_contents($url);
//get uk
$pattern = '/FileUtils.share_uk="(.+?)"/is';
preg_match_all($pattern, $src, $result);
$uk = $result[1][0];
//get shareid
$pattern = '/FileUtils.share_id="(.+?)"/is';
preg_match_all($pattern, $src, $result);
$shareid = $result[1][0];
//get url
$url = 'http://pan.baidu.com/wap/link?shareid=' . $shareid . '&uk=' . $uk;
//get file
getFile(file_get_contents($url));
} elseif ($shareid != '' && $uk != '') {
//get url
$url = 'http://pan.baidu.com/wap/link?shareid=' . $shareid . '&uk=' . $uk;
//get file
getFile(file_get_contents($url));
} else {
echo 'Parameter Error';
return false;
}
function getFile($src) {
//bulid regex
$pattern = '/http:\/\/d.pcs.baidu.com\/[^\"]*expires=8h[^\"]*/is';
preg_match_all($pattern, $src, $result);
//replace
$fileurl = str_replace("\\", "", $result[0][0]);
$fileurl = str_replace("&", "&", $fileurl);
if ($fileurl == '') {
echo 'File Not Found';
return false;
}
header('location: ' . $fileurl);
}
?>