1.php 请求 2.php

1.php:

<?php
$host = '127.0.0.1';
$target = '/2.php';
$referer = 'http://www.Rovi.tk'; //伪造HTTP_REFERER地址
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp){
echo "$errstr($errno)<br />\n";
} 
else{
$out = "
GET $target HTTP/1.1
Host: $host
Referer: $referer
Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)){
echo fgets($fp, 1024);
}
fclose($fp);
}
?>

2.php :

<?php
echo "<hr />";
echo $_SERVER["HTTP_REFERER"];
?>