delphi idhttp get里用 indy idhttpserver 怎么接收post过来的数据

二次元同好交流新大陆
扫码下载App
汇聚2000万达人的兴趣社区下载即送20张免费照片冲印
扫码下载App
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
procedure Get(AURL: string; AResponseContent: TStream);
procedure Get(AURL: string; AResponseContent: TS AIgnoreReplies: array of SmallInt);
function Get(AURL: string): string;
function Get(AURL: string; AIgnoreReplies: array of SmallInt): string;
procedure Get(AURL: AResponseContent: TStream);
procedure Get(AURL: AResponseContent: TS AIgnoreReplies: array of SmallInt);
function Get(AURL: string):
function Get(AURL: AIgnoreReplies: array of SmallInt):其中的最基本的方法是过程类方法[delphi] procedure Get(AURL: string; AResponseContent: TS AIgnoreReplies: array of SmallInt);
procedure Get(AURL: AResponseContent: TS AIgnoreReplies: array of SmallInt);
其他的几个get方法重载都是基于嵌套的此方法。参数:[python] AURL:
// get操作的目标URL
AResponseContent: TS
AIgnoreReplies: array of SmallI
// 忽略掉出现这些http状态码的错误
AURL: // get操作的目标URL
AResponseContent: TS // 返回流
AIgnoreReplies: array of SmallI // 忽略掉出现这些http状态码的错误示例代码:[delphi] unit UM
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, StdC
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
btnGetOne: TB
btnGetTwo: TB
btnGetThree: TB
btnGetFour: TB
procedure btnGetOneClick(Sender: TObject);
procedure btnGetTwoClick(Sender: TObject);
procedure btnGetThreeClick(Sender: TObject);
procedure btnGetFourClick(Sender: TObject);
{ Private declarations }
{ Public declarations }
Form1: TForm1;
implementation
{$R *.dfm}
Cgeturl = '/';
C302url = '/';
RespData : TStringS
procedure TForm1.btnGetOneClick(Sender: TObject);
RespData := TStringStream.Create('');
IdHTTP1.Get(Cgeturl, RespData);
Memo1.Text := RespData.DataS
procedure TForm1.btnGetTwoClick(Sender: TObject);
RespData := TStringStream.Create('');
IdHTTP1.Get(C302url, RespData, [302]);
Memo1.Text := RespData.DataS
procedure TForm1.btnGetThreeClick(Sender: TObject);
Memo1.Text := IdHTTP1.Get(Cgeturl);
procedure TForm1.btnGetFourClick(Sender: TObject);
Memo1.Text := IdHTTP1.Get(C302url, [302]);
阅读(1107)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'[delphi]indy10 idhttp get方法',
blogAbstract:'idhttp中对于get方法的定义:[delphi] '
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}&&&&delphiPOST使用IDHTTP,POST数据到WEB服务器的例子
&delphiPOST使用IDHTTP,POST数据到WEB服务器的例子
使用IDHTTP,POST数据到WEB服务器的例子。-The use of IDHTTP, POST data to a WEB server example.
若举报审核通过,可奖励20下载分
被举报人:
byshadow35
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
您可能还需要
Q.为什么我点的下载下不了,但积分却被扣了
A. 由于下载人数众多,下载服务器做了并发的限制。若发现下载不了,请稍后再试,多次下载是不会重复扣分的。
Q.我的积分不多了,如何获取积分?
A. 获得积分,详细见。
完成任务获取积分。
论坛可用分兑换下载积分。
第一次绑定手机,将获得5个C币,C币可。
关注并绑定CSDNID,送10个下载分
下载资源意味着您已经同意遵守以下协议
资源的所有权益归上传用户所有
未经权益所有人同意,不得将资源中的内容挪作商业或盈利用途
CSDN下载频道仅提供交流平台,并不能对任何下载资源负责
下载资源中如有侵权或不适当内容,
本站不保证本站提供的资源的准确性,安全性和完整性,同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
开发技术下载排行
积分不够下载该资源
如何快速获得积分?
你下载资源过于频繁,请输入验证码
如何快速获得积分?
你已经下载过该资源,再次下载不需要扣除积分
delphiPOST使用IDHTTP,POST数据到WEB服务器的例子
所需积分:5
剩余积分:0
扫描微信二维码精彩活动、课程更新抢先知
VIP会员,免积分下载
会员到期时间:日
剩余下载次数:1000
VIP服务公告:http - Problem with Indy IdHttp Post in Delphi 2010 - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
I have problem with Indy IdHttp Post method.
Function CallRpc() compiled with Delphi 2007 works fine but same code compiled with Delphi 2010 raises exception.
What do I have to consider when I change Delphi 2007 Indy TIdHttp to Delphi 2010 Indy TIdHttp?
function CallRpc(const sURL, sXML: string):
SendStream : TS
SendStream := TMemoryStream.C
IdHttp := TIdHttp.Create(nil);
IdHttp.Request.Accept
IdHttp.Request.ContentType
:= 'text/sXML';
IdHttp.Request.Connection
:= 'Keep-Alive';
IdHttp.Request.ContentLength := Length(sXML);
StringToStream(sXML, SendStream);
SendStream.Position := 0;
Result := IdHttp.Post(sURL, SendStream);
SendStream.F
Addition 25.1.2009:
Exception is this: EIdConnClosedGracefully
Response is this:
&?xml version='1.0' encoding='us-ascii'?&
&!DOCTYPE Error [ &!ELEMENT Error (ErrorMessage,DebuggingInfo*)& &!ATTLIST Error Date CDATA #REQUIRED Time CDATA #REQUIRED& &!ELEMENT ErrorMessage (#PCDATA )&
&!ELEMENT DebuggingInfo (#PCDATA )& ] &
&Error Date='01/25/2010' Time='08:57:12'&
&ErrorMessage&
XML SERVER ERROR: There was a SYSTEM ERROR error in the Incoming XML Response: $ZE=&UNDEFINED&lexan+196^%eXMLLexAnalyzer
&/ErrorMessage&
Solution 26.1.2009:
function CallRpc(const sURL, sXML: string):
SendStream : TS
sAnsiXML: A
// &-- new
sAnsiXML := sXML;
// &-- new: Implicit string cast
SendStream := TMemoryStream.C
IdHttp := TIdHttp.Create(nil);
IdHttp.Request.Accept
IdHttp.Request.ContentType
:= 'text/sXML';
IdHttp.Request.Connection
:= 'Keep-Alive';
IdHttp.Request.ContentLength := Length(sAnsiXML); // &-- new
SendStream.Write(sAnsiXML[1], Length(sAnsiXML));
// &-- new
SendStream.Position := 0;
Result := IdHttp.Post(sURL, SendStream);
SendStream.F
see if making sXML ansistring makes a difference.
Maybe the string is streamed in UTF-16 or so.
17.9k22665
The contentLength is in octets and your string length is in Chars. Since sizeof( Char ) = 2 in Delphi 2009+ this is a mismatch!
Perhaps it is better to convert your XML to/from an UTF8 string. Some aplications will not support the USC2 Unicode format.
You should supply the size of the resulting stream as the ContentLength.
Better yet: don't supply the ContentLength and let Indy do it for you..
3,95511835
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled关于用idhttp发送网站http头的问题_delphi教程-虚拟主机资讯|虚拟主机动态
产品服务快速通道
----------------
==域名注册==
英文域名注册
中文域名注册
==网站推广==
==虚拟主机==
----------------
双线路虚拟主机
基本型虚拟主机
商用型虚拟主机
论坛型虚拟主机
功能型虚拟主机
Vip合租虚拟主机
虚拟主机性能对比
虚拟主机免费试用
机房速度测试
----------------
==租用托管==
服务器租用
----------------
==企业邮局==
购买企业邮局
----------------
==付款方式==
----------------
==联系我们==
您当前位置:->-> ->
关于用idhttp发送网站http头的问题_delphi教程
作者:网友供稿
  西部数码-全国虚拟主机10强!20余项管理功能,全国领先!第6代双线路虚拟主机,南北访问畅通无阻!可在线rar解压,自动数据恢复设置虚拟目录等.免费赠送访问统计,企业邮局.Cn域名注册10元/年,480元起,免费试用7天,满意再付款!P4主机租用799元/月.月付免压金!
文章页数:&
关于用IDhttp发送网站http头的问题近来发现在一个怪问题,第一次发送http头反回数据都正常,但第二次就不正常了,因为第一次请求时返回了一个cookie 。第二次发送时就连这个cookie 也发过去了。本来也没错,但就是这个cookie 的位置不对,倒置发送的http头错误。
看下面的的第一次请求正常:GET
HTTP/1.1Content-Type: text/htmlProxy-Connection: Keep-AliveHost: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*Accept-Language: zh-cnUser-Agent: Mozilla/4.0 ( MSIE 6.0; Windows NT 5.0; MyIE2; CustomExchangeB .NET CLR 1.1.4322)&返回数据:HTTP/1.0 200 OKDate: Fri, 20 May :55 GMTServer: Apache/1.3.33 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.10 FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7aX-Powered-By: PHP/4.3.10Set-Cookie: PHPSESSID=66b3aead5c62e8 path=/Expires: Thu, 19 Nov :00 GMTCache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0Pragma: no-cacheContent-Type: text/htmlX-Cache: MISS from KShieldX-Cache-Lookup: MISS from KShield:8080Proxy-Connection: close第二次请求就变成这样了:GET
HTTP/1.1Content-Type: text/htmlPHPSESSID=66b3aead5c62e8fcaedbe&&& //在这里就多了这一句,所以出错了。Proxy-Connection: Keep-AliveHost: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*Accept-Language: zh-cnReferer: User-Agent: Mozilla/4.0 ( MSIE 6.0; Windows NT 5.0; MyIE2; CustomExchangeB .NET CLR 1.1.4322)Cookie: PHPSESSID=66b3aead5c62e8fcaedbe令人奇怪的是,在我的电脑里运行正常,而发给别人用就不正常,是不是因为我的电脑里有indy的组件呢。还是什么原因,郁闷呀,哪位大哥可以帮我解答呀。QQ: ,注明:idhttp。谢谢
代码如下:第一次请求:&&&& idsearch.Request.Accept:=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*;&&& idsearch.Request.AcceptLanguage:=zh-&&& idsearch.Request.UserAgent:=Mozilla/4.0 ( MSIE 6.0; Windows NT 5.0; MyIE2; CustomExchangeB .NET CLR 1.1.4322);&&& idsearch.Request.ProxyConnection:=Keep-A&&& idsearch.Request.ContentType:=text/&&& SurfUrl:= &&& tmpstr:=idsearch.Get(SurfUrl);&&& if& tmpstr= then&&&&&&& writeLog(连接网站失败..)&&& else&&&&&&& writeLog(连接网站成功..);:第二次请求:cookiestr:=cookie :asdfjiwerfksldafjiweflkasdjfiwidsearch.Request.CustomHeaders.Text:=surfurl1:= &&& idsearch.request.Referer:=SurfU&try&&&&&&& tmpstr:=idsearch.get(surfurl1);&&& except&&&&&&&&& writeLog(失败..);&&&就是这里返回数据出错了。
如何解决呀。
文章整理:西部数码--专业提供、服务
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!
文章页数:&
??????????
??????????
版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。
版权所有 西部数码()
CopyRight (c) 2002~ all right reserved.
公司地址:四川省成都市金牛区一环路北一段99号环球广场24楼 邮编:610031
电话总机:028-08 38
售前咨询:总机转201 202 203 204 206 208
售后服务:总机转211 212 213 214
财务咨询:总机转224 223 传真:028- 财务QQ:
售前咨询QQ:2182518
售后服务QQ:

我要回帖

更多关于 delphi idhttp post 的文章

 

随机推荐