“回复将直接发布到应用程序 URL。一旦发布,应用程序将需要从该信息中获取状态代码和消息 ID 以确定 SMS 传递的结果。”
基本上,我向 API 发送一个 http 请求以发送文本消息,并且该网站进一步将传递状态发送到我给他们的另一个 URL。现在我想使用 http 接收发送到我的应用程序的数据我如何在 asp.net 中做到这一点
编辑部分
NameValueCollection pColl = Request.Params;
// Iterate through the collection and add
// each key to the string variable.
for (int i = 0; i <= pColl.Count - 1; i++)
{
paramInfo += "Key: " + pColl.GetKey(i) + "<br />";
// Create a string array that contains
// the values associated with each key.
string[]pValues = pColl.GetValues(i);
// Iterate through the array and add
// each value to the string variable.
for (int j = 0; j <= pValues.Length - 1; j++)
{
paramInfo += "Value:" + pValues[j] + "<br /><br />";
}
}
Log(add, paramInfo);
上面的代码为我生成以下响应:
Key: result<br />Value:-5<br /><br />Key: transactionid<br />Value:2a8b0559d2a6d96ff2250c5339356293<br /><br />Key: notification<br />Value:msgresult<br /><br />Key: messageid<br />Value:My test message.<br /><br />Key: botkey<br />Value:123456<br /><br />Key: ALL_HTTP<br />Value:HTTP_CONNECTION:keep-alive
HTTP_CONTENT_LENGTH:120
HTTP_CONTENT_TYPE:application/x-www-form-urlencoded
HTTP_ACCEPT:text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
HTTP_HOST:abcdef
HTTP_USER_AGENT:Java/1.6.0_21
HTTP_TRANSACTIONID:2a8b0559d2a6d96ff2250c5339356293
HTTP_MESSAGEID:95a8e9c37b9e449fe47e7d3acdd6f6e5
br /><br />Key: ALL_RAW<br />
如果 Key 的值是-5,我需要从整个响应中得到什么:结果