当前位置:Gxlcms > PHP教程 > php异步请求文件实现多线程的代码

php异步请求文件实现多线程的代码

时间:2021-07-01 10:21:17 帮助过:4人阅读

  1. $content='';

  2. $fp = fsockopen("bbs.it-home.org", 80, $errno, $errstr, 30);
  3. if (!$fp) {
  4. echo "$errstr ($errno)
    \n";
  5. } else {
  6. $out = "POST /test.php?id=5".$content." HTTP/1.1\r\n";
  7. $out .= "Host:www.php100.com\r\n";
  8. $out .= "Content-Length: ". strlen($content) ."\r\n";
  9. $out .= "Connection: Close\r\n\r\n";
  10. $out .= $content;
  11. $out .= "\r\n\r\n";
  12. fwrite($fp, $out);

  13. /*//忽略执行结果

  14. while (!feof($fp)) {
  15. echo fgets($fp, strlen($content));
  16. } */
  17. echo 'zhinxging';
  18. fclose($fp);
  19. }

人气教程排行