Home >Backend Development >PHP Tutorial >某网盘里的压缩包rar格式外链有referer检测防盗链,求php,该怎么处理

某网盘里的压缩包rar格式外链有referer检测防盗链,求php,该怎么处理

WBOY
WBOYOriginal
2016-06-13 12:02:55973browse

某网盘里的压缩包rar格式外链有referer检测防盗链,求php
某网盘里的压缩包rar格式外链有referer检测防盗链,本人想把它放到博客上,让人直接可以下载,请问怎么伪造来路,然后可以打得开下载这个rar格式的文件,求php代码
之前自己瞎折腾了代码http://bbs.csdn.net/topics/390842920 ,感觉不大好
------解决方案--------------------

$url = '/某个连接地址url.rar格式';<br />$ch = curl_init(); //初始化<br />curl_setopt($ch, CURLOPT_URL, $url); //你要访问的页面<br />curl_setopt($ch, CURLOPT_REFERER, '某个来路url'); //伪造来路页面<br />curl_setopt($ch, CURLOPT_HEADER, 1); //要读回 http 头<br />curl_setopt($ch, CURLOPT_WRITEFUNCTION, 'func'); //监听返回的数据<br />curl_exec($ch); //执行<br /><br />function func($ch, $str) {<br />  static $s = '@';<br />  if($s) {<br />    $s = trim($str);<br />    if($s) header($s); //如果是头信息,则发送相应的头<br />  }else echo $str; //否则发送数据<br />  return strlen($str);<br />}<br />

既然对方提供的是下载,那么相关信息自然已经都提供了,包括文件名和文件长度

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn