Sorularınız çok karışık olmuş ancak anladığım kadarıyla web sitenizden programınıza veri, mesaj göndermek istiyorsunuz.
Web siteniz üzerinden bir form elemanı oluşturun, sonrasında butona tıkladığınızda form içerisindeki textbox verisini POST isteği ile gönderin.
PHP tarafında bu gelen POST isteğini işleyin.
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$text = $_POST['text'];
$response = array('text' => $text);
$json_response = json_encode($response);
header('Content-Type: application/json');
echo $json_response;Burası sunucu tarafında veri işleme kısmıydı.
C# ile geliştirdiğiniz program istemci oluyor.
Sunucudan istemciye aktarmanız için, sunucu tarafında API oluşturun.
C# nuget paketlerinden Newtonsoft.Json kurulumunu yapıp başvurulara
using System.Text.Json; ekleyin.
Daha sonrasında c# ile sunucunuzdaki API ile iletişim kurmaya başlayabilirsiniz.
string url = "http://x.com/api.php";
string postData = "text=" + textBoxValue;
string jsonResponse;
using (WebClient client = new WebClient()) {
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
jsonResponse = client.UploadString(url, postData); }
JsonDocument jsonDoc = JsonDocument.Parse(jsonResponse);
string responseText = jsonDoc.RootElement.GetProperty("text").GetString();Bu kod sunucunuzda işlenen text verisini POST isteği göndererek json formatında alır parçalar ve text anahtarındaki değeri alır.