$postData = array(
'action' => 'req',
'type' => 'post'
);
$postData = http_build_query($postData);
$fp = fsockopen('localhost', 80, $errno, $errorStr, 5);
$reqData = "POST /reg.php HTTP/1.1\r\n";
$reqData .= "HOST:localhost\r\n";
$reqData .= "Content-type:application/x-www-form-urlencoded\r\n";
$reqData .= "Content-length:" . strlen($postData) . "\r\n\r\n";
fwrite($fp, $reqData);
while(!feof($fp)) {
echo fgets($fp, 1024) . '.Hello World\r\n';
}
fclose($fp);
exit;
服务端echo粗来,but报错500