我正在通过 plivo 在移动设备上发送短信,然后用户将通过是或否回复我以在我的 plivo 上接收短信。现在我在 c# 中创建了类并输入了这段代码
using System;
using System.Collections.Generic;
using System.Reflection;
using Nancy;
using RestSharp;
using Plivo.API;
namespace Receive_Sms
{
public class Program : NancyModule
{
public Program()
{
Post["/receive_sms"] = x =>
{
String from_number = Request.Form["From"]; // Sender's phone number
String to_number = Request.Form["To"]; // Receiver's phone number
String text = Request.Form["Text"]; // The text which was received
// Print the message
Console.WriteLine("Message received - From: {0}, To: {1}, Text: {2}", from_number, to_number, text);
return "Message received";
};
}
}
}
如果可以,我可以在 webservice.asmx 中使用此代码吗?我如何测试这段代码?在消息 url 中创建应用程序时,我在服务器 url 类名或方法名之后写了什么?例如http://example.com/receive_sms