TWebBrowser and POST request
来源:互联网 发布:linux下查看ftp用户 编辑:程序博客网 时间:2024/06/06 01:12
Today I want to describe how you can send some data to web-server from your remote script using TWebBrowser component.
var strData: string; PostData: OleVariant; Headers: OleVariant; i: Integer;begin {1. you must create a string with parameter names and values Result string must be in the next format: Param1=Value1&Param2=Value2&Param3=Value3...} strData := 'Param1Name=' + HTTPEncode(Param1Value) + '&' + 'Param2Name=' + HttpEncode(Param2Value) + ...; {2. you must convert a string into variant array of bytes and every character from string is a value in array} PostData := VarArrayCreate([0, Length(strData) - 1], varByte); { copy the ordinal value of the character into the PostData array} for i := 1 to Length(strData) do PostData[i-1] := Ord(strData[i]); {3. prepare headers which will be sent to remote web-server} Headers := 'Content-Type: application/x-www-form-urlencoded' + #10#13; {4. you must navigate to the URL with your script and send as parameters your array with POST-data and headers} yourWebBrowserComponent.Navigate('http://www.yourdomain.com/your_post_script.asp', EmptyParam, EmptyParam, PostData, Headers);end;
Of course, the same task can be solved with any internet component which implement the http-client (not only TWebBrowser). But for every component the data for script will be posted by own rules (most components have pre-defined properties for this task).
For example, you can use my TSMIHTTPClient component from SMInternet suite. There you must set Action=haPost and fill the Headers property with own Post-data
- TWebBrowser and POST request
- post form data with TWebBrowser?
- [asp.net] Get variables from POST and GET request
- 用TWebBrowser 组件 POST 数据和预览 HTML 片段
- get post request区别
- $GET $POST 和 $REQUEST
- REQUEST , GET , POST
- get 、post、request详解
- request post get
- 400 (bad request) post
- python post request
- Get,Post和Request
- simulate POST request
- nodejs request post 请求
- PHP-$GET/$REQUEST/$POST
- Spray handle Post request
- Django中的request.GET和request.POST
- Django中的request.GET和request.POST
- TListView的ListItem完全自绘
- 如何用idhttp提交自己构造过的Cookie
- Putty字体和中文输入的设置
- Delphi实现网页表单数据的自动提交
- 如何取消VI查询后的显示
- TWebBrowser and POST request
- 50个gmail邀请,要的mail我
- Error establishing socket.错误排除
- piner 的 Oracle DBA 面试题!
- 将应用程序的随机启动写入注册表的方法
- 常量
- 类变量
- 2006年12月11日
- 明天去见绿盟的老板去