Home > php教程 > php手册 > body text

php 异步请求文件,实现多线程

WBOY
Release: 2016-06-21 08:51:18
Original
912 people have browsed it

php 异步请求文件,实现多线程源码
$content='';
$fp = fsockopen("www.php100.com", 80, $errno, $errstr, 30);
if (!$fp) {
        echo "$errstr ($errno)
\n";
} else {
$out = "POST /test.php?id=5".$content." HTTP/1.1\r\n";
$out .= "Host:www.php100.com\r\n";
$out .= "Content-Length: ". strlen($content) ."\r\n";
$out .= "Connection: Close\r\n\r\n";
$out .= $content;
         $out .= "\r\n\r\n";
fwrite($fp, $out);

/*//忽略执行结果
while (!feof($fp)) {
echo fgets($fp, strlen($content));
} */
echo 'zhinxging';
fclose($fp);
}



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template