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

WBOY
Release: 2016-06-23 13:53:11
Original
1037 people have browsed it

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


回复讨论(解决方案)

伪造referer

伪造referer



求代码

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!