unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP;type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Memo1: TMemo;
Memo2: TMemo;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
const
DFW_LOGIN_URL = 'http://xiaonei.com/Login.do';
var
HTML: string;
Params: TStrings;
begin
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
Params := TStringlist.Create;
IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Alexa Toolbar; 56flvplayer 1.0)';try
Params.Add(AnsiToUtf8('email='+edit1.Text));
Params.Add(AnsiToUtf8('password='+edit2.Text));
Params.Add(AnsiToUtf8('autoLogin=ture')); //是否记住我的密码
HTML:= IdHttp1.Post(DFW_LOGIN_URL, Params);//分析HTML,这里的HTML没有任数据
finally
Memo1.Lines.Add(Utf8ToAnsi(HTML));
Params.Free;
end;
end;procedure TForm1.Button2Click(Sender: TObject);
var
HTML: string;
begin
idhttp1.ReadTimeout:=10000 ;//超时, 似乎超时的设置没起作用。
IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Alexa Toolbar; 56flvplayer 1.0)';try
HTML:=idhttp1.GET('http://xiaonei.com/Home.do');
finally
Memo2.Lines.Add(Utf8ToAnsi(HTML));
end;
end;
end.总是提示"HTTP/1.0 302 FOUND"错误。555。我都尝试了很多方法了,而且在网上搜了好多资料,结果还是没解决。哎
帮帮偶~!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP;type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Memo1: TMemo;
Memo2: TMemo;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
const
DFW_LOGIN_URL = 'http://xiaonei.com/Login.do';
var
HTML: string;
Params: TStrings;
begin
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
Params := TStringlist.Create;
IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Alexa Toolbar; 56flvplayer 1.0)';try
Params.Add(AnsiToUtf8('email='+edit1.Text));
Params.Add(AnsiToUtf8('password='+edit2.Text));
Params.Add(AnsiToUtf8('autoLogin=ture')); //是否记住我的密码
HTML:= IdHttp1.Post(DFW_LOGIN_URL, Params);//分析HTML,这里的HTML没有任数据
finally
Memo1.Lines.Add(Utf8ToAnsi(HTML));
Params.Free;
end;
end;procedure TForm1.Button2Click(Sender: TObject);
var
HTML: string;
begin
idhttp1.ReadTimeout:=10000 ;//超时, 似乎超时的设置没起作用。
IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Alexa Toolbar; 56flvplayer 1.0)';try
HTML:=idhttp1.GET('http://xiaonei.com/Home.do');
finally
Memo2.Lines.Add(Utf8ToAnsi(HTML));
end;
end;
end.总是提示"HTTP/1.0 302 FOUND"错误。555。我都尝试了很多方法了,而且在网上搜了好多资料,结果还是没解决。哎
帮帮偶~!
Params.Add(AnsiToUtf8( 'email= '+edit1.Text));
Params.Add(AnsiToUtf8( 'password= '+edit2.Text));
Params.Add(AnsiToUtf8( 'autoLogin=ture ')); //是否记住我的密码
这个包不可能只有这三项,至少还要有 一项 表示 你在网站上点了登陆这个按钮..............建议 你先登陆 ,用抓包软件 抓一下有哪些,然后再全部模拟出来.........
302错误好象是地址跳转吧~~都有点忘记拉呵呵~~还不行联系我
恩
确实是有地址跳转
那怎么才能get到跳转后的地址呢
不过按扭的名字自已查准确吧把网站:input的都要写在参数中的