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使用ajax添加一个cookie
最新推荐文章于 2021-08-06 08:59:20 发布
本文介绍如何使用 Delphi 的 COM 对象 XMLHTTPRequest 发送 POST 请求,并设置 Cookie 和请求参数。通过实例展示了如何获取响应文本及处理响应状态。
379

被折叠的 条评论
为什么被折叠?



