宅男噜噜噜66在线观看,亚洲精品一区二区三区精品,亚洲一区二区三区乱码在线欧洲,亚洲精品久久麻豆蜜桃,亚洲色无色a片一区二区

您是否正受到短信簽名報備的困擾?互億無線解決方案讓您最快15分鐘內(nèi)恢復(fù)信息傳遞,馬上 注冊體驗(yàn)。
所有文檔
銀行信息核驗(yàn)
應(yīng)用開發(fā)
運(yùn)營商信息核驗(yàn)
文檔中心 > 運(yùn)營商信息核驗(yàn) > 空號檢測

空號檢測

C#對接空號檢測提交接口接口DEMO示例
本文為您提供了C#語言版本的空號檢測提交接口接口對接DEMO示例

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text.Json;

class Program
{
    private const string host = "https://api.ihuyi.com";
    private const string path = "/empty-number/submit";
    private const string method = "POST";

    static void Main(string[] args)
    {
        // 定義請求的數(shù)據(jù)
        var values = new Dictionary<string, object>
        {
                {"mobiles": new List<string> { "18800000000", "18800000001" }}, //手機(jī)號數(shù)組(最多10個)
        };

        // 將數(shù)據(jù)轉(zhuǎn)換為JSON字符串
        string jsonBody = JsonSerializer.Serialize(values);
        byte[] data = Encoding.UTF8.GetBytes(jsonBody);

        string url = host + path;
        HttpWebRequest httpRequest = null;
        HttpWebResponse httpResponse = null;

        if (host.Contains("https://"))
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
            httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
        }
        else
        {
            httpRequest = (HttpWebRequest)WebRequest.Create(url);
        }
        
        httpRequest.Method = method;
        httpRequest.ContentType = "application/json";
        httpRequest.Data = "Tue, 26 Aug 2025 07:14:23 GMT"; // 請?zhí)鎿Q為當(dāng)前的GMT時間
        httpRequest.Authorization = "Signature xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; //請?zhí)鎿Q為您的鑒權(quán)簽名
        httpRequest.ContentLength = data.Length;
        
        // 將JSON數(shù)據(jù)寫入請求體
        using (Stream stream = httpRequest.GetRequestStream())
        {
            stream.Write(data, 0, data.Length);
        }
        
        try
        {
            httpResponse = (HttpWebResponse)httpRequest.GetResponse();
        }
        catch (WebException ex)
        {
            httpResponse = (HttpWebResponse)ex.Response;
        }

        Console.WriteLine(httpResponse.StatusCode);
        Console.WriteLine(httpResponse.Method);
        Console.WriteLine(httpResponse.Headers);
        Stream st = httpResponse.GetResponseStream();
        StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
        Console.WriteLine(reader.ReadToEnd());
        Console.WriteLine("\n");

        // 釋放資源
        reader.Close();
        st.Close();
        if (httpResponse != null) 
            httpResponse.Close();
    }

    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }
}

5分鐘快速自助開通免費(fèi)體驗(yàn)賬戶

在線咨詢
電話咨詢

服務(wù)熱線:

4008 808 898

服務(wù)熱線(工作時間):

4008 808 898

業(yè)務(wù)咨詢(非工作時間):

售后咨詢(非工作時間):