推荐文章

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符
C#监控程序启动和关闭

C#监控程序启动和关闭

C#监控程序启动和关闭using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.Threading;namespace ProcessListener{ class Program { static void Main(stri
C#操作USB口的摄像头

C#操作USB口的摄像头

private const uint BM_CLICK = 0xF5; 鼠标点击的消息,对于各种消息的数值,查API手册,也可用VS2010自带的SPY++ [DllImpt("user32.dll", EntryPoint = "SendMessage", SetLastErr = true, Set = Set.Auto)]private static extern int SendMe
C# FTP操作

C# FTP操作

C# FTP操作
C#文件监控对象FileSystemWatcher

C#文件监控对象FileSystemWatcher

使用C#文件监控对象FileSystemWatcher对文件夹下的删除、修改、新增

C# POST数据到API

日期:2020-04-01 点击:3052 来源:PB2.CN
static void Main(string[] args)
{
    string url = "http://API网址";
    Encoding encoding = Encoding.GetEncoding("utf-8");
    //参数
    String str = "******";
    String param = "{\"com\":\"******\",\"num\":\"" + str + "\",\"from\":\"\",\"to\":\"\"}";
    String customer = "******";
    String key = "******";
    MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
    byte[] InBytes = Encoding.GetEncoding("UTF-8").GetBytes(param + key + customer);
    byte[] OutBytes = md5.ComputeHash(InBytes);
    string OutString = "";
    for (int i = 0; i < OutBytes.Length; i++)
    {
        OutString += OutBytes[i].ToString("x2");
    }
    String sign = OutString.ToUpper();
    IDictionary parameters = new Dictionary();
    parameters.Add("param", param);
    parameters.Add("customer", customer);
    parameters.Add("sign", sign);
    HttpWebResponse response = Program.CreatePostHttpResponse(url, parameters, encoding);
    //打印返回值
    Stream stream = response.GetResponseStream();   //获取响应的字符串流
    StreamReader sr = new StreamReader(stream); //创建一个stream读取流
    string html = sr.ReadToEnd();   //从头读到尾,放到字符串html
    Console.WriteLine(html);
}


这篇文档对您是否有帮助?

上一篇:无
下一篇:C# 使用Spire.PDF提取PDF文本和图片
c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符
C#监控程序启动和关闭

C#监控程序启动和关闭

C#监控程序启动和关闭using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.Threading;namespace ProcessListener{ class Program { static void Main(stri
C#操作USB口的摄像头

C#操作USB口的摄像头

private const uint BM_CLICK = 0xF5; 鼠标点击的消息,对于各种消息的数值,查API手册,也可用VS2010自带的SPY++ [DllImpt("user32.dll", EntryPoint = "SendMessage", SetLastErr = true, Set = Set.Auto)]private static extern int SendMe
C# FTP操作

C# FTP操作

C# FTP操作
C#文件监控对象FileSystemWatcher

C#文件监控对象FileSystemWatcher

使用C#文件监控对象FileSystemWatcher对文件夹下的删除、修改、新增