我给你贴的代码 就是我使用的,就是www.163.com 我更改了一下,怕你我我的ip 更改成你的ip .你说加特征值,这个也好办,但是不管怎么 你的对asp 了解点,否则实现有点难度.
这个是我 看别人的,我测试过 也好用
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls, ComCtrls, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
state: TStatusBar;
IdHTTP1: TIdHTTP;
Memo1: TMemo;
Label2: TLabel;
Edit2: TEdit;
Button2: TButton;
Label3: TLabel;
Memo2: TMemo;
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);
var
name:String;
password:string;
GetURL :String;
PostURL :String;
GetHtml :String;
sParams :String;
aParams :TStrings;
aStream :TStringStream;
begin
IdHTTP1 := TIdHTTP.Create(nil);
aParams := TStringList.Create;
aStream := TStringStream.Create('');
memo1.Lines.Clear ;
name:=edit1.Text ;
password:=edit2.Text ;
GetURL := 'http://localhost/ssw/ssiptxt.asp'; {登录页面网址}
PostURL := 'http://localhost/ssw/ssiptxt.asp?ip='+password; {提交网址}
sParams := 'name='+name; {提交参数}
try
aParams.Clear;
aParams.Add(sParams);
GetHtml := IdHTTP1.Get(GetURL); {取登录页面}
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Post(PostURL, aParams, aStream); {提交}
memo1.lines.Add(aStream.DataString);
memo1.SelectAll ;
finally
IdHTTP1.Free;
aParams.Free;
aStream.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close();
end;
end.