我在SMS API集成中遇到错误.... [英] I am facing error in SMS API integration....

查看:68
本文介绍了我在SMS API集成中遇到错误....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此错误即将来临

The method or operation is not implemented.






$ b




on

throw new NotImplementedException();





我尝试过:



i我正在尝试使用SMS的短信集成创建编码。





What I have tried:

i am trying to create coding for SMS integration with API of SMS.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;



namespace WebApplication31
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        string MyUsername = "923228279278"; //Your Username At Sendpk.com 
        string MyPassword = "4379"; //Your Password At Sendpk.com 
        string toNumber = "923228279278"; //Recepient cell phone number with country code 
        string Masking = "SMS Alert"; //Your Company Brand Name 
        string MessageText = "SMS Sent using .Net";
        string jsonResponse = SendSMS ("Masking", "toNumber", "MessageText"," MyUsername", "MyPassword");

        private static string SendSMS(string p1, string p2, string p3, string p4, string p5)
        {
            throw new NotImplementedException();
        }
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            String URI = "http://Sendpk.com" +
            "/api/sms.php?" +
            "username=" + MyUsername +
            "&password=" + MyPassword +
            "&sender=" + Masking +
            "&mobile=" + toNumber +
            "&message=" + Uri.UnescapeDataString(MessageText); // Visual Studio 10-15 
            //"&message=" + System.Net.WebUtility.UrlEncode(MessageText);// Visual Studio 12 
            try
            {
                WebRequest req = WebRequest.Create(URI);
                WebResponse resp = req.GetResponse();
                var sr = new System.IO.StreamReader(resp.GetResponseStream());
                //return sr.ReadToEnd().Trim(); 
            }
            catch (WebException ex)
            {
                var httpWebResponse = ex.Response as HttpWebResponse;
                if (httpWebResponse != null)
                {
                    switch (httpWebResponse.StatusCode)
                    {
                        case HttpStatusCode.NotFound:
                        //return "404:URL not found :" + URI; 
                        //break; 
                        case HttpStatusCode.BadRequest:
                        //return "400:Bad Request"; 
                        //break; 
                        default:
                            break;
                       //return httpWebResponse.StatusCode.ToString(); 

                    }
                }
                //return null; 
            }
        }
    }
}

推荐答案

调用SendSMS方法你的



That SendSMS method is called in your

string jsonResponse =





line 。因为您似乎不需要它而删除该行。每当你调用SendSMS时,你都会得到异常,因为这是方法抛出的异常。



line. Remove that line as you don't seem to need it. Any time you call SendSMS you'll get that exception because that is the exception the method is throwing.


这篇关于我在SMS API集成中遇到错误....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆