Відправити тескові данні в PHP
C#
using System.Net;
using System.Collections.Specialized;
string URL = "http://site.com/1.php";
WebClient webClient = new WebClient();
NameValueCollection formData = new NameValueCollection();
formData["name"] = "Andriy";
formData["phone"] = "+38(067) 777-77-77";
byte[] responseBytes = webClient.UploadValues(URL, "POST", formData);
string responsefromserver = Encoding.UTF8.GetString(responseBytes);
Console.WriteLine(responsefromserver);
webClient.Dispose();
PHP
<?php
$file = "1.txt";
$data = $_POST["name"] . " " . $_POST["phone"];
file_put_contents($file, $data, FILE_APPEND);
print_r("Done");
?>