delphi使用ajax添加一个cookie

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;

你可能感兴趣的:(Delphi)