本帖最后由 CrazyNut 于 2019-10-5 21:17 编辑
太菜
易语言里面这个不知道怎么弄到C#里面
c# 我用的HttpCode 和 HttpClient
谢谢大佬们
============================================
已经解决
https://www.cnblogs.com/a849788087/p/7562161.html
[C#] 纯文本查看 复制代码 [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)] //API设定Cookie
static extern int InternetSetCookieEx(string lpszURL, string lpszCookieName, string lpszCookieData, int dwFlags, IntPtr dwReserved);
[DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)] //API获取Cookie
static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved);
private string GetCookieString(string url) //url通过API获取完整Cookie
{
uint datasize = 256;
StringBuilder cookieData = new StringBuilder((int)datasize);
if (!InternetGetCookieEx(url, null, cookieData, ref datasize, 0x2000, IntPtr.Zero))
{
if (datasize < 0)
return null;
cookieData = new StringBuilder((int)datasize);
if (!InternetGetCookieEx(url, null, cookieData, ref datasize, 0x00002000, IntPtr.Zero))
return null;
}
return cookieData.ToString();
} |