Hello, I could be not able use Traccar GSM Gateway Android App for sending SMS in Local Area Network. With a lot of efforts I failed to use it... I am developing in Asp.net C#? Here is my Sample code
public static void Send(string IpAdress, string contactNo, string Message)
{
UriBuilder uriBuilder = new UriBuilder("http", IpAdress, Convert.ToInt32(8082));
string webTarget = uriBuilder.ToString();
// Parameters to send with API request.
string webPost = "to={0}&message={1}";
// Create new HTTP request.
string url = webTarget;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] postData = Encoding.ASCII.GetBytes(String.Format(webPost, contactNo, "This is a test from C#"));
req.ContentLength = postData.Length;
// Set HTTP authorization header.
req.Headers.Add("Authorization", "1b3ef055");
// Send HTTP request.
using (Stream PostStream = req.GetRequestStream())
{
PostStream.Write(postData, 0, postData.Length);
}
//Stream PostStream = req.GetRequestStream();
//PostStream.Write(postData, 0, postData.Length);
using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())
{
if (res.StatusCode == HttpStatusCode.Created)
{
Console.WriteLine("SMS message has been sent.");
}
else
{
Console.WriteLine("ERROR: There was a problem sending your messaging.");
}
}
}
Hello, I could be not able use Traccar GSM Gateway Android App for sending SMS in Local Area Network. With a lot of efforts I failed to use it... I am developing in Asp.net C#? Here is my Sample code