using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.Unicode;
namespace 客户端
{
internal class Class1
{
static void Mian(string[] args)
{
}
private static void Post()
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("https://t.bilibili.com/?spm_id_from=333.1007.0.0");
request.Method = "POST";
request.ContentType = "application/json";
//写入
using (StreamWriter write = new StreamWriter(request.GetRequestStream(), Encoding.GetEncoding("UTF-8")))
{
write.Write("");
}
HttpWebResponse respone = (HttpWebResponse)request.GetResponse();
Stream responseStream = respone.GetResponseStream();
string result = new StreamReader(responseStream).ReadToEnd();
Console.WriteLine(result);
responseStream.Close();
}
private static void Get()
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("https://t.bilibili.com/?spm_id_from=333.1007.0.0");
request.Method = "GET";
//响应
HttpWebResponse respone = (HttpWebResponse)request.GetResponse();
Stream responseStream = respone.GetResponseStream();
string result = new StreamReader(responseStream).ReadToEnd();
Console.WriteLine(result);
responseStream.Close();
}
}
}