请问delphi如何xmlhttp提交表单并接收返回的网页网址?

丷与你初见丷 2013-05-01 09:37:26
想用xmlhttp写个自动登录
网上的例子太少了
小白求指教,感谢。
function HTTPPOST1(const url: ansistring): ansistring;
var
r: OleVariant;
s: ansistring;
ceshi:string;
var
xmlHttp: OleVariant;
begin
url:='https://auth.eve-online.com.cn/oauth/authorize?client_id=eveclient&scope=eveClientLogin&response_type=token&redirect_uri=https%3A%2F%2Fauth.eve-online.com.cn%2Flauncher%3Fclient_id%3Deveclient';
ceshi:='Username=123456&Password=123456'';
xmlHttp := CreateOleObject('MSXML2.XMLHTTP');
try
xmlHttp.open('POST',url,false);
xmlHttp.setRequestHeader('Content-Length', IntToStr(Length(ceshi)));
xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlHttp.send(ceshi);
Result:=xmlHttp.ResponseText;
finally
xmlHttp:=Unassigned;
end;
end;
...全文
237 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
OO_is_just_P 2013-05-10
  • 打赏
  • 举报
回复
直接IdHttp搞定
sololie 2013-05-10
  • 打赏
  • 举报
回复
看, 有飞碟
Y.A.K.E 2013-05-09
  • 打赏
  • 举报
回复
一个很神奇的解决方法 xmlHttp.send(ceshi); 这里不用变量。直接写入数据 xmlHttp.send('Username=123456&Password=123456');

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧