You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
963 B

// 引入名字空间
using System.Collections.Generic;
using System.Linq;
using System.Net;
using UnityEngine;
using UnityEngine.UI;
public class WebUIView : MonoBehaviour
{
private void Start()
{
GetHttpCookies("https://hyl.educoder.net");
//var list = GetHttpCookies("https://hyl.educoder.net");
//foreach (var item in list)
//{
// Debug.Log(item);
//}
}
public static List<string> GetHttpCookies(string Url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
request.Method = "GET";
request.ContentType = "text/html;charset=UTF-8";
var response = (HttpWebResponse)request.GetResponse();
var resultAsync = request.GetResponseAsync();
var cookies=response.Cookies;
Debug.Log(cookies.Count);
return new List<string>();
// return resultAsync.Result.Headers.GetValues("Set-Cookie").ToList();
}
}