Reputation: 525
I have only HTTP API for my SMS gateway for which I create an ASP.NET application to send SMS using ASP.NET page. The below string url
is the HTTP API. Now, how to post this url
in ASP.NET page to send SMS.
protected void Page_Load(object sender, EventArgs e)
{
string userk = "***********";
string passk = "***********";
string senderk = "someid";
string phonek = "00000000000";
string messagek = "This is a test API";
string priorityk = "ndnd";
string typek = "normal";
string url = "http://indiansms.smsmaker.in/api/sendmsg.php?user=" + userk + "&pass=" + passk + "&sender=" + senderk + "&phone=" + phonek + "&text=" + messagek + "&priority=" + priorityk + "&stype=" + typek;
}
Upvotes: 0
Views: 1164
Reputation: 30095
Maybe using HttpWebRequest
with preset data
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("https://myurl");
request.Method = "POST";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Upvotes: 0
Reputation: 1499840
Have you tried using either WebRequest
or WebClient
? The fact that you're doing this from within an ASP.NET page is mostly irrelevant...
Note that you should escape URI parameters - otherwise you'll run into trouble with values such as a message of "hello & goodbye".
Upvotes: 0