欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

PHP中伪造HTTP_REFERER代码_PHP教程

程序员文章站 2024-02-05 09:35:46
...
  1. error_reporting( E_ERROR | E_WARNING | E_PARSE );
  2. set_time_limit(0);
  3. $server = www.2cto.com; // IP address
  4. $host = www.2cto.com; // Domain name
  5. $target = /test.php?x=1; // Specific program
  6. $referer = http://www.php100.net/down/redirect.php?x=downurl&id=39&urlid=65; // Referer
  7. $port = 80;
  8. $re = fsockopen($server, $port, $errno, $errstr, 30);
  9. if (!$re){
  10. echo "h1>无法连接远程服务器h1>h3>$errstr ($errno)h3/> ";
  11. }
  12. else {
  13. $strhead = "GET $target HTTP/1.1 ";
  14. $strhead .= "Host: $host ";
  15. //$strhead .= "Cookie: PHPSESSIONIDSQTBQSDA=DFCAPKLBBFICDAFMHNKIGKEG ";
  16. $strhead .= "Referer: $referer ";
  17. $strhead .= "Connection: Close ";
  18. fwrite($re, $strhead);
  19. while (!feof($re)){
  20. echo fgets($re, 128);
  21. }
  22. fclose($re);
  23. }

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486043.htmlTechArticleerror_reporting(E_ERROR|E_WARNING|E_PARSE); set_time_limit(0); $ server = www.2cto.com ;//IPaddress $ host = www.2cto.com ;//Domainname $ target = /test.php?x=1 ;//Specificprogram...