C# 配置SMS API

C# 配置SMS API,c#,winforms,api,sms,C#,Winforms,Api,Sms,我从尼日利亚的一个短信经销商那里得到了这个API。我想知道如何正确插入文本框值 API:http://smsmobile24.com/components/com_spc/smsapi.php?username=xxx&password=yyy&sender=@@发件人@@@recipient=@@recipient@@@message=@@message@@ 我需要插入密码,用户名,当然还有发件人和收件人 我尝试过这样做: string to, msg; to = smsRecipientBo

我从尼日利亚的一个短信经销商那里得到了这个API。我想知道如何正确插入文本框值 API:
http://smsmobile24.com/components/com_spc/smsapi.php?username=xxx&password=yyy&sender=@@发件人@@@recipient=@@recipient@@@message=@@message@@

我需要插入密码,用户名,当然还有发件人和收件人

我尝试过这样做:

string to, msg;
to = smsRecipientBox.Text;
msg = smsMsgBox.Text;
http://smsmobile24.com/components/com_spc/smsapi.php?username=C***er&password=fath****am&sender=Cmanager&recipient='“+to+'”和message='“+msg+”


但是我看到红线告诉我有一个错误。

您不能修改常量值(用
const
modifier标记的变量)

这里有两个选项:

1) 从字段中删除
常量

2) 使用格式在常量字符串的占位符中插入值:

const string url = "http://smsmobile24.com/components/com_spc/smsapi.php?username=C***er&password=fath****am&sender=Cmanager&recipient={0}&message={1}";

var to = smsRecipientBox.Text;
var msg = smsMsgBox.Text;

string result = string.Format(url, to, msg);

红线是怎么说的呢?常量中的换行符和它的结尾。如果你能提供一个有用的代码片段和输出,回答起来会很容易。通过查看您提供的代码片段,我们无法确定出现了什么问题,因为您只提供了两个变量的设置值片段。:)非常感谢。这真的很有帮助