我正在尝试使用asp.net和c#.net构建一个Web应用程序,我必须将sms发送到某些手机。我从go-sms.com购买了用户名和密码,他们给了我这个:
http://<url_to_be_provided>?company=<COMPANY_LOGIN>&user=<USERID>&password=<ENCODED_PASSWORD>&gateway=<GATEWAY>&mode=BUK&type=TX&hp=<MSISDN>&mesg=<MESSAGE_CONTENT>&charge=0&maskid=<MASKID>&convert=0
以下是我迄今为止尝试过的代码(来自本网站:http://forums.asp.net/t/1883175.aspx):
protected void btnSend_Click(object sender, EventArgs e)
{
try
{
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://<url_to_be_provided>?company=<COMPANY_LOGIN>&user=<USERID>&password=<ENCODED_PASSWORD>&gateway=<GATEWAY>&mode=BUK&type=TX&hp=<MSISDN>&mesg=" + txtMsg.Text.ToString() +" &charge=0&maskid=<MASKID>&convert=0"); // I am so sorry, as for confidential purpose I could not provide the values for the http link, company,user id and password
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
}
catch (Exception ex)
{
Response.Write(ex);
}
}
但是当我按下发送按钮时,我无法获得短信。所以,我想请求这里的专家帮助我。我如何编写代码来利用它或如何编辑我当前的代码以便在手机上获取短信。
谢谢。