Delphi Chromium Embedded控件怎么获取cookie-CSDN论坛
1个回答
展开全部
获取post,或者get返回的cookie,除了过滤返回的字符串之外,最简单的方法是使用idhttp的CookieManager属性。
比如获得IDhttp返回的全部Cookie:
if idhttp1.CookieManager.CookieCollection.Count > 0 then
for i := 0 to idhttp1.CookieManager.CookieCollection.Count - 1 do
temp := temp + idhttp1.CookieManager.CookieCollection.Items[i] .CookieText + ';';
也可以通过属性名和属性值的形式获得,这样就可以提取出个别的Cookie值:
idhttp1.CookieManager.CookieCollection.Items[i]
.CookieName idhttp1.CookieManager.CookieCollection.Items[i]
.Value
比如:
temp := TStringList.Create;
if idhttp1.CookieManager.CookieCollection.Count > 0 then
for i := 0 to idhttp1.CookieManager.CookieCollection.Count - 1 do
// temp := temp + idhttp1.CookieManager.CookieCollection.Items[i] .CookieText + ';';
temp.Add(idhttp1.CookieManager.CookieCollection.Items[i]
.CookieName + '=' + idhttp1.CookieManager.CookieCollection.Items[i]
.Value);
比如获得IDhttp返回的全部Cookie:
if idhttp1.CookieManager.CookieCollection.Count > 0 then
for i := 0 to idhttp1.CookieManager.CookieCollection.Count - 1 do
temp := temp + idhttp1.CookieManager.CookieCollection.Items[i] .CookieText + ';';
也可以通过属性名和属性值的形式获得,这样就可以提取出个别的Cookie值:
idhttp1.CookieManager.CookieCollection.Items[i]
.CookieName idhttp1.CookieManager.CookieCollection.Items[i]
.Value
比如:
temp := TStringList.Create;
if idhttp1.CookieManager.CookieCollection.Count > 0 then
for i := 0 to idhttp1.CookieManager.CookieCollection.Count - 1 do
// temp := temp + idhttp1.CookieManager.CookieCollection.Items[i] .CookieText + ';';
temp.Add(idhttp1.CookieManager.CookieCollection.Items[i]
.CookieName + '=' + idhttp1.CookieManager.CookieCollection.Items[i]
.Value);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询