system idle process是什麼進程 php模擬socket一次連接,多次發送資料的實現代碼
複製程式碼 程式碼如下:
//post.php
function Post($host,$port)
{
//$host="127.0.0$port)
{
//$host="127.0.0.連線
$conn = fsockopen($host,$port);
if (!$conn)
{
die("Con error");
}
//迴圈傳送5次資料
//
for($i = 0;$i{
$data="user_name=admin".$i;
WriteData($conn,$host,$data);
echo $i."
" ;
}
fclose($conn);
}
function WriteData($conn,$host,$data)
{
$header = "POST /test.php HTTP/1.1";
$header = "POST /test.php HTTP/1.1";
$header.= "Host : {$host}rn";
$header.= "Content-type: application/x-www-form-urlencodedrn";
$header.= "Content-Length:".strlen($data)."rn" ;
//Keep-Alive是關鍵
$header.= "Connection: Keep-Alivernrn";
$header.= "{$data}rnrn";
fwrite($conn,$header);
//取結果
//$result = '';
//while(!feof($conn))
//{
// $result .= fgets($conn,128);
//}
//return $result ;
}
Post('127.0.0.1',80);
複製程式碼
程式碼如下:p result.txt','a');
$data = $_POST['user_name']." -- ". date('Y-m-d H:i:s')."rn";
fwrite($fp,$ data);
fclose($fp);
?>
以上就介紹了system idle process是什麼進程 php模擬socket一次連接,多次發送資料的實現代碼,包括了system idle process是什麼進程方面的內容,希望對PHP教程有興趣的朋友有所幫助。

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)