לפני חודש

@אהרן-שובקס

אני מקוה שזה הכל, השתדלתי לאסוף את כל הקוד הרלוונטי. (C# כמובן)

using System.Net.Http;
using Newtonsoft.Json;
using System.Net;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using System.Runtime.Remoting.Contexts;
using System.Security.Policy;
using static System.Net.WebRequestMethods;

 static readonly HttpClient client = new HttpClient();
 private async void button1_Click1(object sender, EventArgs e)
 {
 string[] json = new string[3];

 var jsonContent1 = new
 {
     what = "ivr2:SaleProducts/sale_products_name.ini",
     contents = textBox1.Text.Replace("\r\n", "%0a")
 };
 json[0] = System.Text.Json.JsonSerializer.Serialize(jsonContent1);
 HttpContent content;

 for (int i = 0; i < json.Length; i++)
 {
     content = new StringContent(json[i], Encoding.UTF8, "application/json");
     string url = $"https://www.call2all.co.il/ym/api/UploadTextFile?token={numberTb.Text}:{passTb.Text}";
     try
     {
         // שליחת בקשת POST
         HttpResponseMessage responseJ = await client.PostAsync(url, content);

         // בדיקת מצב התגובה
         if (responseJ.IsSuccessStatusCode)
         {
             // קריאת התוכן של התגובה
             string responseContent = await responseJ.Content.ReadAsStringAsync();
             textBox1.Text += $"{url} Response: {responseContent}";
         }
         else
         {
             MessageBox.Show("הפעולה נכשלה", "שגיאה");
             textBox1.Text += $"Error: {responseJ.StatusCode}";
             return;
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine($"Exception: {ex.Message}");
     }
 }
}