且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

给我发送用于向手机发送短信的代码

更新时间:2022-11-27 10:37:39

请参阅以下链接:
ASP.Net中用于发送SMS的代码 [ ^ ]

如何在ASP中发送短信.c通过使用c#.net [使用c#与asp.net进行sms激活 [ ^ ]

^ ]
See these links:
Code in ASP.Net for sending SMS[^]

How to send sms in asp.net by using c#.net[^]

sms intigretion with asp.net with c#[^]

http://weblogs.asp.net/rajneesh-verma/archive/2011/10/17/sending-sms-through-asp-net-using-sms-sending-api-from-providers.aspx[^]


在阅读代码之前,这里有一些详细信息,您需要了解.

就像发送电子邮件一样,您需要SMTP,而SMS则需要SMPP. SMPP-短消息对等协议是用于交换SMS消息的电信行业协议.现在对于个人而言,不可能购买SMPP服务器,因此这里是SMS服务提供商.尽管大多数SMS服务提供者都是伪造的,并且在真实服务提供者(具有集成的SMPP)下充当经销商的角色.

该代码非常简单.大多数情况下,您需要执行HTTP Post.

因此,没有任何特定的代码可以帮助您.首先选择服务提供商并购买一些积分,它们将为您提供示例代码.


以下是适用于大多数服务提供商的示例代码,

Before going through the code, here are some details, you need to understand.

Just like sending email, you need a SMTP, for SMS you need a SMPP. SMPP - Short Message Peer-to-Peer protocol is a telecommunications industry protocol for exchanging SMS messages. Now for individuals, it is not possible to afford SMPP server, so here goes the SMS Service Provider. Though most of the SMS Service providers are fake and work just as a reseleer under a Real Service Provider(have integrated SMPP).

The code is very straight forward. Most of the cases, you need to do HTTP Post.

So, no particular code will help you. First select the Service Provider and buy some credits and they will provide you the sample code.


Here is a sample code works with most of the Service Provider,

string senderusername = "xxxxx";
string senderpassword = "xxxx";
string senderid = "xxx";        
string sURL;
StreamReader objReader;
sURL = "service provider url with username,password,senderid,messagetext,tomobile and others passed as querysrring";
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(sURL);
try
{
     Stream objStream;
     objStream = wrGETURL.GetResponse().GetResponseStream();
     objReader = new StreamReader(objStream);
     //here you get the response - sent success or fail
     objReader.Close();
}
catch (Exception ex)
{
   ex.ToString();
}



希望这能使您清除.

欢呼声



Hope this clears you.

cheers


请检查以下网址,这将帮助您使用way2sms帐户发送短信

从.NET桌面应用程序发送短信 [ ^ ]
Please check below url, this will help you to send sms using way2sms account

Sending SMS From .NET Desktop Application[^]