时间:2021-07-01 10:21:17 帮助过:5人阅读
伪造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);}