[PHP] 深入剖析PHP输入流 php://input →→→→→进入此内容的聊天室

来自 , 2019-09-18, 写在 PHP, 查看 105 次.
URL http://www.code666.cn/view/5e6d27a7
  1. //@file phpinput_post.php
  2. $http_entity_body = 'n=' . urldecode('perfgeeks') . '&p=' . urldecode('7788');
  3. $http_entity_type = 'application/x-www-form-urlencoded';
  4. $http_entity_length = strlen($http_entity_body);
  5. $host = '192.168.0.6';
  6. $port = 80;
  7. $path = '/phpinput_server.php';
  8. $fp = fsockopen($host, $port, $error_no, $error_desc, 30);
  9. if ($fp) {
  10.   fputs($fp, "POST {$path} HTTP/1.1\r\n");
  11.   fputs($fp, "Host: {$host}\r\n");
  12.   fputs($fp, "Content-Type: {$http_entity_type}\r\n");
  13.   fputs($fp, "Content-Length: {$http_entity_length}\r\n");
  14.   fputs($fp, "Connection: close\r\n\r\n");
  15.   fputs($fp, $http_entity_body . "\r\n\r\n");
  16.  
  17.   while (!feof($fp)) {
  18.     $d .= fgets($fp, 4096);
  19.   }
  20.   fclose($fp);
  21.   echo $d;
  22. }
  23.  

回复 "深入剖析PHP输入流 php://input"

这儿你可以回复上面这条便签

captcha