Sending SMS using HQSMS API in asp.net
To use HQSMS API you need to 1st Register at HQSMS. They will provide you some credit for testing your app. But to send more sms you have to buy credit from them. Below is the code for sending SMS to a user in asp.net. here I'm using System.Net library from asp.net and then obviously HQSMS APIs.
protected void sendButton_Click(object sender, EventArgs e)
{
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://www.hqsms.com/api/send.do?username=username&password=md5_password&to=to_phoneNo&message=Please Work!&from=HQRoute"));
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
System.IO.StreamReader strreader = new System.IO.StreamReader(response.GetResponseStream());
string deliver = strreader.ReadToEnd();
Response.Write(deliver);
}
here,
username = username in HQSMS registration
password = passowrd needs to be hashed in MD5. To get a MD5 hash of your password, please go here: https://www.hqsms.com/md5.php
to_phone = destination phone number
from = source phone number or source user.
Done! Pretty easy huh? Leave some comments if you have any questions about it.
protected void sendButton_Click(object sender, EventArgs e)
{
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://www.hqsms.com/api/send.do?username=username&password=md5_password&to=to_phoneNo&message=Please Work!&from=HQRoute"));
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
System.IO.StreamReader strreader = new System.IO.StreamReader(response.GetResponseStream());
string deliver = strreader.ReadToEnd();
Response.Write(deliver);
}
here,
username = username in HQSMS registration
password = passowrd needs to be hashed in MD5. To get a MD5 hash of your password, please go here: https://www.hqsms.com/md5.php
to_phone = destination phone number
from = source phone number or source user.
Done! Pretty easy huh? Leave some comments if you have any questions about it.
Good one :-)
ReplyDeleteThanks! I hope it helped you.
ReplyDeleteits not working for me
ReplyDeleteWhat is the error you are getting?
ReplyDeleteHi i am getting ERROR:14. Please help me......
ReplyDeletecould you please post the full error message?
ReplyDeleteHello here you have full list of error codes: http://www.hqsms.com/help-api/api-error-codes
ReplyDelete