delphi使用ajax添加一个cookie

来源:互联网 发布:网络阅卷查分入口 编辑:程序博客网 时间:2024/06/05 03:21
uses Comobj;

var
url:string;
xmlHttp:Olevariant;
responseText:Widestring;
begin
url:
='http://xxx.cn/xx.asp';
try
xmlHttp:
=CreateOleObject('Msxml2.XMLHTTP');
xmlHttp.open(
'POST',url,false);
xmlHttp.setRequestHeader(
'Cookie', 'cookietest=testvalue');
xmlHttp.send(
'xxxx');
responseText:
=xmlHttp.responseText;
if xmlHttp.status='200' then
begin
//--
end
else
begin
//--
end;
except
On E:Exception
do
//--
end;
end;