作者:瓦尔登湖 | 来源:互联网 | 2013-04-22 17:17
php异步请求文件,实现多线程源码$content='';$fp=fsockopen("www.php100.com",80,$errno,$errstr,30);if(!$fp){echo"$errstr($errno)<br
php 异步请求文件,实现多线程源码
$cOntent=&#39;&#39;;
$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 &#39;zhinxging&#39;;
fclose($fp);
}