复制代码 代码如下:
<?php
$canshu=$_SERVER["QUERY_STRING"];
if($canshu=="")
{
die("文件不存在");
}
else
{
$wangzhi="http://pan.baidu.com/share/link?".$canshu;
$file=file_get_contents($wangzhi);
$pattern='/a><a href=(.*?)id="downFileButtom">/i';
preg_match_all($pattern,$file,$result);
$tempurl=implode("",$result[1]);
$fileurlt=str_replace("/"","",$tempurl);
$fileurl=str_replace("&","&",$fileurlt);
header("location:$fileurl");
}
?>
复制代码 代码如下:
<?php
require_once('snoopy.class.php');
//http://www.abc.com/bdp.php?shareid=29160&uk=2855065916
$url = 'http://pan.baidu.com/share/link?shareid=' . $_GET['shareid'] . '&uk=' . $_GET['uk'];
$snoopy = new Snoopy();
$snoopy -> read_timeout = 0;
$snoopy -> fetch($url);
$n = $snoopy -> results;
$regex = '/(_.src=")(.+)(";)/';
$match = '';
preg_match($regex, $n, $match);
if(preg_match('/.gif/', $match[2])){
header("Content-type: image/gif");
imagegif(imagecreatefromgif($match[2]));
}elseif(preg_match('/.jpg/', $match[2])){
header("Content-type: image/jpeg");
imagejpeg(imagecreatefromjpeg($match[2]));
}elseif(preg_match('/.png/', $match[2])){
header("Content-type: image/png");
imagepng(imagecreatefrompng($match[2]));
}elseif(preg_match('/.wbmp/', $match[2])){
header("Content-type: image/vnd.wap.wbmp");
imagewbmp(imagecreatefromwbmp($match[2]));
}else{}
?>
新闻热点
疑难解答