Create a new file file.php. The next parameter is the target address of the referfer that needs to be forged. such as: File.php/http://www.xxx.xxx/xxx.mp3
copy content to clipboardCode:
<?
$url =str_replace ('/file.php/', ' ', $_server[' Request_uri "]);//Get the URL that needs to be converted. Here I am lazy, do not do safety test, need to add up
$downfile =str_replace ("", "%20", $url);//replace spaces, etc., can be replaced according to the actual situation
$downfile =str_replace ("http://", "", $downfile);
$urlarr =explode ("/", $downfile);//split the domain name with "/"
$domain = $urlarr [0];//domain name
$getfile =str_replace ($urlarr [0], ", $downfile);//Get part of the header
$content = @fsockopen ("$domain", $errno, $errstr, 12);//Connect the target host
if (! $content) {//link not on the prompt error
Die ("Sorry, unable to connect on $domain. ");
}
Fputs ($content, "GET $getfile http/1.0\r\n");
Fputs ($content, "Host: $domain \ r \ n");
Fputs ($content, "Referer: $domain \ r \ n");//Forged part
Fputs ($content, "user-agent:mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) \r\n\r\n ");
while (!feof ($content)) {
$tp. =fgets ($content, 128);
if (Strstr ($TP, "OK")) {//here to illustrate. The first line of the header is typically the state of the requested file. Please refer to the HTTP 1.1 status code and its meaning hi.baidu.com/110911/blog/item/21f20d2475af812ed50742c5.html here is the normal file request status, just a direct turn on it. Continuation program for other states
Header ("Location: $url");
Die ();
}
}
302 turn, most of the anti-theft chain system is the first to judge the Referfer, the words then turn to the real address. Here's how to get the real address.
$arr =explode ("\ n", $TP);
$arr 1=explode ("Location:", $TP);//Break out the real-time address at the back of
$arr 2=explode ("\ n", $arr 1[1]);
Header (' content-type:application/force-download ');//MandatoryDownload
Header ("Location:". $arr 2[0]);//Turn to Destination address
Die ();
?>
115 Network tray outside the chain PHP version
copy content to clipboardCode:
<?php
$uri = $_SERVER["REQUEST_URI"];
preg_match("/115.php\/(.+)\//",$uri,$code);//自己修改
$code = $code[1];
$opts = array(
‘http‘=>array(‘method‘=>"GET",‘header‘=>"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.3)\r\n")
);//伪造User-Agent
$context = stream_context_create($opts);
$url = "https://uapi.115.com/?ct=upload_api&ac=get_pick_code_info&pickcode=".$code."&version=1164";//获得原始
$data = file_get_contents($url,false,$context);
$data = str_replace("\\","",$data);
preg_match_all("/\"Url\":\"(.*?)\"/", $data, $data);
$myurl = $data[1][2];//获得备份下载
if($myurl){
header(‘Content-Type:application/force-download‘);//强制下载
header("Location:".$myurl);
die();
}
else echo "提取码不存在或已过期";
?>
115 NET disk picture chain test (not I do):
Original address: http://u.115.com/file/f3d81ef173
PHP forged Referer Break out of the network to prohibit the chain (with 115 source code)