Replace user, password, msisdn, sid and message accordingly.
1. Below is the sample code for asp.net for Single Message:
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string apiUrl = "http://sms.domainadda.com/vendorsms/pushsms.aspx";
string user = "abc";
string password = "xyz";
string msisdn = "919898xxxxxx";
string sid = "SenderId";
string message = "test message";
string fl = "0";
string gwid = "2";
string fullUrl = $"{apiUrl}?user={user}&password={password}&msisdn={msisdn}&sid={sid}&msg={Uri.EscapeDataString(message)}&fl={fl}&gwid={gwid}";
using (HttpClient client = new HttpClient())
{
HttpResponseMessage response = await client.GetAsync(fullUrl);
if (response.IsSuccessStatusCode)
{
string apiResponse = await response.Content.ReadAsStringAsync();
Console.WriteLine("API response: " + apiResponse);
}
else
{
Console.WriteLine("Error sending request. Status code: " + response.StatusCode);
}
}
}
}
2. Below is the sample code for asp.net for Multiple Messages:
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string apiUrl = "http://sms.domainadda.com/vendorsms/pushsms.aspx";
string user = "abc";
string password = "xyz";
string msisdns = "919898xxxxxx,919898xxxxxx"; // Comma-separated list of phone numbers
string sid = "SenderId";
string message = "test message";
string fl = "0";
string gwid = "2";
string fullUrl = $"{apiUrl}?user={user}&password={password}&msisdn={msisdns}&sid={sid}&msg={Uri.EscapeDataString(message)}&fl={fl}&gwid={gwid}";
using (HttpClient client = new HttpClient())
{
HttpResponseMessage response = await client.GetAsync(fullUrl);
if (response.IsSuccessStatusCode)
{
string apiResponse = await response.Content.ReadAsStringAsync();
Console.WriteLine("API response: " + apiResponse);
}
else
{
Console.WriteLine("Error sending request. Status code: " + response.StatusCode);
}
}
}
}