I want to call to a API using a class library.
Here is the way they need us to send the post request
Or
To achecive this I use this code
public class Keey
{
public string username { get; set; }
public string passward { get; set; }
public string src { get; set; }
public string dst { get; set; }
public string msg { get; set; }
public string dr { get; set; }
}
public void SendSms(string phoneNo, string SMS)
{
Keey account = new Keey
{
username = "*****",
passward = "*********",
src = "test.com",
dst = phoneNo,
msg = SMS,
dr = "1",
};
WebRequest request = WebRequest.Create("http://testserver.com ");
// Set the Method property of the request to POST.
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = SMS.Length;
CredentialCache.DefaultNetworkCredentials.UserName = account.username;
CredentialCache.DefaultNetworkCredentials.Password = account.passward;
request.Credentials = CredentialCache.DefaultNetworkCredentials;
WebResponse response = request.GetResponse();
}
But I dont know where to add those port,src,dst,msg etc... Please help me
Code is in C#