最近在学DELPHI7时遇到了问题;代码运行无错误,但就是没反应,抓包工具也抓不到数据,关了防活墙,加了ANTIFREE组件也没用,不知什么原因,代码如下:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
IdHTTP1: TIdHTTP;
WebBrowser1: TWebBrowser;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
no1:String;
no2:string;
PostURL :String;
sParams :String;
aParams :TStrings;
aStream :TStringStream;
beginIdHTTP1 := TIdHTTP.Create(nil);
aParams := TStringList.Create;
aStream := TStringStream.Create('');no1:='9' ;
no2:='222' ;
PostURL:='http://www.*****.com/factory/vote.aspx?r='+ no1; //提交网址
sParams:= 'uid='+no2; //参数
try
aParams.Clear;
aParams.Add(sParams);
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Post(PostURL, aParams, aStream); //提交
finally
IdHTTP1.Free;
aParams.Free;
aStream.Free;
end;end;
end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
IdHTTP1: TIdHTTP;
WebBrowser1: TWebBrowser;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
no1:String;
no2:string;
PostURL :String;
sParams :String;
aParams :TStrings;
aStream :TStringStream;
beginIdHTTP1 := TIdHTTP.Create(nil);
aParams := TStringList.Create;
aStream := TStringStream.Create('');no1:='9' ;
no2:='222' ;
PostURL:='http://www.*****.com/factory/vote.aspx?r='+ no1; //提交网址
sParams:= 'uid='+no2; //参数
try
aParams.Clear;
aParams.Add(sParams);
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Post(PostURL, aParams, aStream); //提交
finally
IdHTTP1.Free;
aParams.Free;
aStream.Free;
end;end;
end.
解决方案 »
- 截取后边3位数
- TListView的使用,
- 系统剪贴板的操作进行文件的复制粘贴 delphi
- 我用ToolBar做MDI程序的主菜单,为何在子窗口菜单不能加到主窗口的ToolBar菜单里呢? 我以做了,GroupIndex设置呢.为什么还不对?
- 设置了权限只能打开两按钮之一,但怎么两个都能用了~~??
- 如何设置控件之间的相对大小
- 请问如何更改从文件load的TADOQuery对象的字段内容
- tag属性是干什么的?
- 关于DBGRID
- 把数据控件放到窗体和放到数据模块里有什么区别?
- 怎么在delphi的adoquery里判断一个数据库database是否存在?
- webbrowser 的(WebBrowser1.Document as IHTMLDocument2).cookie与用httpwatch查看到的不一样
~~~路过~~~~~~友情UP~~~