所有文档
企业信息核验
文档中心 > 企业信息核验 > 企业详情信息核验V2

企业详情信息核验V2

C#对接提交查询接口DEMO示例

本文为您提供了C#语言版本的提交查询接口对接DEMO示例


using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;

class Program
{
    private const String host = "https://api.ihuyi.com";
    private const String path = "/idcard/entinfov2/Submit.json";
    private const String method = "POST";

    static void Main(string[] args)
    {
        String bodys = "account=xxxxxxxx&password=xxxxxxxxx&ent_name=上海xx信息技术有限公司&ent_code=9121xxxxxxxxxN&organization_code=123xxxxx®_no=301xxxxxxx [注:企业名称、统一社会信用代码、组织机构代码、企业注册号四选一传递]";
        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/x-www-form-urlencoded";
        if (0 < bodys.Length){
            byte[] data = Encoding.UTF8.GetBytes(bodys);
            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");

    }

    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }
}
在线咨询
服务热线:
4008 808 898

免费体验

提交成功
若短信发送异常,系统将自动给您发送语音验证码,请注意接听电话。

填写验证码后,点击“开通体验账户”自动开通体验账户。

收不到短信验证码?
×