C# winform端使用WebClint的OpenWrite向php頁面寫入資料
C#程式碼:
string url = "http://xxx.xxx.xxx/request.php"; string str = "hello world"; WebClient http = new WebClient(); http.Encoding = Encoding.UTF8; Stream postStream = http.OpenWrite(url, "POST"); byte[] postArray = Encoding.UTF8.GetBytes(str); postStream.Write(postArray, 0, postArray.Length); postStream.Close();php接收方式
<?php $input = file_get_contents("php://input"); ?>
評論(3)