Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]c#格式API接口代码如何转换为FT格式

1楼
洮沙 发表于:2024/3/3 18:23:00
老师,有以下C#格式API接口代码如何转为FT格式?能否麻烦老师帮忙转换一下,万分谢谢!
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography;

public class Test{

public const String appId = "数脉分配给你的appid";
public const String appSecurity = "数脉分配给你的appsecurity";

public static string GetMD5(string myString) {
MD5 md5 = new MD5CryptoServiceProvider();
byte[] fromData = System.Text.Encoding.UTF8.GetBytes(myString);
byte[] targetData = md5.ComputeHash(fromData);
string byte2String = null;

for (int i = 0; i < targetData.Length; i++) {
byte2String = byte2String+ targetData[i].ToString("x2");
}
return byte2String;
}

public static void Main(string[] args) {
long t = (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds);
String str = appId + "&" + t + "&" + appSecurity;
String sign = GetMD5(str);
String keyword = "关键字,公司名全称、注册号、社会统一信用代码";

HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;

String url = "https://api.shumaidata.com/v4/business4/get?appid="+appId+"×tamp="+t+"&sign="+sign+"&keyword="+keyword;

if (url.Contains("https://")) {
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
} else {
httpRequest = (HttpWebRequest)WebRequest.Create(url);
}
httpRequest.Method = "GET";
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;
}
}

[此贴子已经被作者于2024/3/3 18:24:26编辑过]
2楼
有点蓝 发表于:2024/3/3 20:26:00
转换网站:https://converter.telerik.com/,转换后把命名空间放入代码里
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03320 s, 2 queries.