本文為您提供了C#語(yǔ)言版本的提交查詢接口對(duì)接DEMO示例
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
private const String host = "https://api.ihuyi.com";
private const String path = "/veh/entcap/Submit.json";
private const String method = "POST";
static void Main(string[] args)
{
String querys = "account=xxxxxxxx&password=xxxxxxxxx&ent_name=上海xx車輛公司®_no=12345678&ent_code=913******N&time=1623643787&";
String bodys = "";
String url = host + path;
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;
if (0 < querys.Length){
url = url + "?" + querys;
}
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.Headers.Add("Authorization", "APPCODE " + appcode);
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;
}
國(guó)內(nèi)專業(yè)互聯(lián)網(wǎng)團(tuán)隊(duì)
21年行業(yè)經(jīng)驗(yàn)
7x24小時(shí)售后支持
豐富的行業(yè)經(jīng)驗(yàn)
互 億 無 線 官 方 微 信 號(hào)
Copyright ? 2004-2025 上海思銳信息技術(shù)有限公司 All rights reserved. 滬ICP備07035915號(hào)-15 電信增值業(yè)務(wù)許可證:B2-20160082
服務(wù)熱線:
4008 808 898
服務(wù)熱線(工作時(shí)間):
4008 808 898
業(yè)務(wù)咨詢(非工作時(shí)間):
售后咨詢(非工作時(shí)間):
驗(yàn)證碼已發(fā)送到您的手機(jī),請(qǐng)查收!
輸入驗(yàn)證碼后,點(diǎn)擊“開通體驗(yàn)賬戶”按鈕可立即開通體驗(yàn)賬戶。