idhttp在post表单的问题 [问题点数:60分,结帖人cnotes]

Bbs2
本版专家分:232
结帖率 92.31%
Bbs7
本版专家分:16106
Blank
红花 2012年4月 Delphi大版内专家分月排行榜第一
2012年3月 Delphi大版内专家分月排行榜第一
Bbs2
本版专家分:232
Bbs7
本版专家分:16106
Blank
红花 2012年4月 Delphi大版内专家分月排行榜第一
2012年3月 Delphi大版内专家分月排行榜第一
Bbs5
本版专家分:3485
Bbs5
本版专家分:4608
Bbs2
本版专家分:232
Bbs2
本版专家分:232
Bbs5
本版专家分:3485
Bbs2
本版专家分:232
Bbs2
本版专家分:232
Bbs5
本版专家分:3485
Bbs2
本版专家分:232
Bbs4
本版专家分:1732
Bbs4
本版专家分:1732
Bbs4
本版专家分:1732
Bbs2
本版专家分:232
Bbs4
本版专家分:1732
Bbs4
本版专家分:1732
Bbs4
本版专家分:1732
Bbs2
本版专家分:232
Bbs2
本版专家分:232
Bbs2
本版专家分:232
Bbs4
本版专家分:1732
delphi 7 idhttp post 的8种使用方法
delphi 7 <em>idhttp</em> <em>post</em> 的8种使用方法(含源码),介绍了8种使用方法,供学习交流使用。
Idhttp Post
E.....@.......e.v.o...PPH.p.r=.P...@_..POST /lbr_sports HTTP/1.1..Accept: */*..Referer: http://www.lad168.com/lbr_sports?action=INT_SPORTSBOOK::go_sports_menu..Accept-Language: zh-cn..Content-Type: application/x-www-form-urlencoded..Accept-Encoding: gzip, deflate..User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Alexa Toolbar)..Host: www.lad168.com..Content-Length: 405..Connection: Keep-Alive..Cache-Control: no-cache..Cookie: LANG=cs; flash_version=6; CP=null*; CASAFF_ID=default; RC_AFF=0; EXT_AFF=; CTXT=PORTAL; BETSLIP=refresh|0|selns|0; FLAGS=cs|cs|cs|fareast|DECIMAL|0|GBP....action=INT_SPORTSBOOK%3A%3Ado_sports_menu&this_action=INT_SPORTSBOOK%3A%3Ago_sports_menu&checked_subtypes=370&checked_evtypes=&checked_ordered=S+370+&expanded_classes=110000045&expanded_evtypes=&sel_disp_sort_id=&sel_disp_sort_tmpl=&mkt_ev_oc_grp_id=&mkt_disp_sort_id=&mkt_template=&mkt_chkd_ordered=&timefilter=&category=&class_id=&class_sort=&type=&id=&ev_id=&ev_mkt_id=&int_event=&gr_trap=&auto_submit=rn如何把上面的数据 Post给页面(上面的信息是用网络数据监视器截取的)
idhttp post数据的问题
用<em>idhttp</em>.<em>post</em>登陆数据,得到返回结果,怎么得到的还是未登陆的信息?rnrn代码:rnvar param :TstringList;rn Response: TStringStream;rnbeginrnResponse := TStringStream.Create('');rnparam:=TstringList.create;rnparam.add('membername=user');rnparam.add('memberpass=password');rnrn<em>idhttp</em>1.<em>post</em>('http://www.2ccc.com',param,Response);rnmemo1.text:=Response;rnrn...rnend;rnrn返回的信息还是未登陆的,请高手指教。
idhttp组件post参数的问题
参数中带有 &= 类似这种特殊符号的时候,<em>post</em>过去的数据就被服务器认为是错的,无法返回我想要的东西rnrn是不是有什么编码设置还是什么?怎么弄呢?
xe2 idhttp post乱码的问题
以前用d7、indy9写的程序:用两个函数实现客户端读取服务器端的asp程序生成的xml,一直没什么<em>问题</em>,现在用xe2,用了utf8toansi,utf8decode都会出现乱码,用浏览器却可以正常显示,不知道怎么解决了rn[code=Delphi(Pascal)]rnfunction GetdataAsp(AspName:string; StrSql:String):WideString;rnbeginrn tryrn ConnectUrl := 'Http://'+ConnectIni+AspName;rn ReSult := <em>post</em>Xml(StrSql,ConnectUrl);rn exceptrn on Ex:exception dorn beginrn ShowMessage(Ex.Message);rn assignfile(ErrorF,ExtractFilePath(Application.exename)+'ErrorMessage.txt');rn Append(ErrorF);rn tryrn writeln(ErrorF,DateTimeToStr(now)+' | '+Ex.Message);rn finallyrn closefile(ErrorF);rn end;rn end;rn end;rnend;rnrnfunction <em>post</em>Xml(const xmlstr, url: WideString): WideString;rnvarrn idHttp:TIdHTTP;rn sends:tstrings;rn IdEncoderMIME1:TIdEncoderMIME;rn vStream: TMemoryStream;rnbeginrn result:='';rn tryrn idHttp:= TIdHTTP.Create(nil);rn idHttp.Request.ContentType := 'application/x-www-form-urlencoded';rn <em>idhttp</em>.Request.AcceptCharSet := 'UTF-8';rn <em>idhttp</em>.Request.AcceptEncoding := 'UTF-8';rn <em>idhttp</em>.Request.AcceptLanguage := 'UTF-8';rn sends:=tstringlist.Create;rn sends.Add('strSQL='+(xmlstr));rn result:=<em>idhttp</em>.Post(url,sends);rn exceptrn on Ex:exception dorn beginrn assignfile(ErrorF,ExtractFilePath(Application.exename)+'ErrorMessage.txt');rn Append(ErrorF);rn tryrn writeln(ErrorF,DateTimeToStr(now)+' | '+Ex.Message);rn finallyrn closefile(ErrorF);rn end;rn end;rn end;rn idHttp.Free;rn sends.Free;[/code]
请教关于IdHTTP Post的问题
这是我的代码,是BCB的 rn AnsiString UserName,Password, BaseURL;rn AnsiString HTML;rnrn BaseURL = "http://10.0.0.1/start.nsf/";rn UserName = "guest";rn Password = "guest";rn TStringList* Params = new TStringList();rn Params->Add("Username="+UserName);rn Params->Add("Password="+Password);rn Params->Add("comeurl="+BaseURL+"homepage?OpenFrameSet"); // 这里是登录成功后自动转入的页面,如果没有通过验证而访问此页面,将转入登录页面。 代码目标是需要取得此页面的内容rnrn //IdHTTP1->Request->ContentType="application/x-www-form-urlencoded";rn IdHTTP1->Post(BaseURL+"firstpage?openpage",Params); //这里是登录页面rn Memo1->Text = HTML;rn delete Params;rnrn下面是登录页面的HTML源码,为何每次获得到结果都是它? 好像没有通过验证(确认登录密码没错)请高手看看<em>问题</em>出在哪,谢谢!rnrnrnrnrn rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn 用户名: rn rnrn rn rn 密码:rn rnrn rn rn rn rn rnrnrn rn rn rn rn rn rn rn rn rn │技术支持│联系我们│rnrnrn rnrn rn rnrn rn rn rnrn rnrnrnrn
关于 idhttp 通过 post 方式登录 https 形式的网站的问题
我用的是 delphi2010 控件是 <em>idhttp</em>,TIdCookieManager,TIdSSLIOHandlerSocketOpenSSL <em>idhttp</em> 的属性:选了 hoKeepOrigPro
delphi的idhttp的get 和 post的使用
delphi的<em>idhttp</em>的get 和 <em>post</em>的使用 2014-12-21 17:31 4023人阅读 评论(1) 收藏 举报  分类:   Delphi(146)  版权声明:本文为博主原创文章,未经博主允许不得转载。 [delphi] view plain copy function Tform1.
idhttp post方法Demo
Delphi第三方组件<em>idhttp</em> <em>post</em>方法的详细演示。 具体说明见:http://blog.csdn.net/none01/article/details/8657543
idhttp post 方法发送数据到服务器上。实现数据和网页的交互。
http://www.blabla.com/login.php method=POST> text name=nick id=insert_feld1> password name=passwort id=insert_feld1> submit value=Login id=insert_feld1>//网页代码;Soweit bi
IdHTTPServer1 收到POST 文件和参数
使用INDY 10 ,不然有些单元可能无法找到编译。 目前发现的<em>问题</em>有:对于#$0A 会自动转变成 #$0D#$0A,在传输文件时最好是进行编码传输。网上搜索这类信息很少,好像是Decoder.ReadBody <em>问题</em>,传文本文件之类的一切正常。留着以前再改进吧。 uses   Winapi.Windows, Winapi.Messages, System.SysUtils, System.V
delphi7 idhttp post中文的问题
delphi7 <em>idhttp</em> <em>post</em>中文的<em>问题</em>rn[code=Delphi(Pascal)][/code]procedure TForm1.fasong();rnvarrn Params1:TStrings;rn url:string;rn tmp:string;rnrn beginrnrn IdHTTP1.AllowCookies:=false;rn Params1 :=TStringList.Create;rn tryrnrn IdHTTP1.Request.Accept:= '*/*';rn IdHTTP1.Request.ContentType:= 'application/x-www-form-urlencoded';rn IdHTTP1.Request.Host:= 'www.xxx.com';rn IdHTTP1.Request.AcceptEncoding:= 'gzip, deflate';rn IdHTTP1.Request.Referer:= 'http://www.xxx.com/qwe/index.php';rn IdHTTP1.HTTPOptions:=IdHTTP1.HTTPOptions+[hoKeepOrigProtocol];rn IdHTTP1.ProtocolVersion:=pv1_1;rn IdHTTP1.Request.CustomHeaders.Clear;rn IdHTTP1.Request.CustomHeaders.add(t);rn tryrn Params1.Append('id=111');rn Params1.Append('name=登录');rn tryrn url := 'http://www.xxx.com/qwe/iii.php';rn IdHTTP1.HandleRedirects:=true;rn tmp:=<em>idhttp</em>1.Post(url,Params1);rn exceptrn end;rn exceptrn end;rn finallyrnrn Params1.Free;rn end;rnend;rn抓包显示‘登录'是 %B5%C7%C2%BC 而不是UTF8,怎样才能POST出去的数据是UTF8编码的?rn谢谢!
idhttp组件post网页问题
最近为了学习,做一个小小BBS灌水回贴器,登录没<em>问题</em>,可就是对get来的贴无法回复,<em>post</em>后返回来的结果是:抱歉,您的请求来路不正确或<em>表单</em>验证串不符,无法提交rn网站是PHP Discuz! X2rn代码如下:rn IdHttp1.AllowCookies:=True;rn IdHttp1.HandleRedirects:=True;rn IdHTTP1.HTTPOptions:=IdHTTP1.HTTPOptions+[hoKeepOrigProtocol];rn //IdHttp1.Request.Accept := 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/xaml+xml, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-xpsdocument, */*';rn IdHttp1.Request.AcceptLanguage := 'zh-cn';rn IdHttp1.Request.AcceptEncoding := 'gzip,deflate';rn IdHttp1.Request.ContentLength := 98;rn IdHttp1.Request.ContentType:='application/x-www-form-urlencoded' ;rn IdHttp1.Request.Connection := 'Keep-Alive';rn IdHttp1.Request.CacheControl := 'no-cache';rn IdHttp1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)';rn IdHttp1.Host := 'bbs.hfdiaoyu.com';rnrn IdHttp1.Request.CustomHeaders.Text:='Cookie:'+mycookie;rnrn rn IdHttp1.Request.Referer := 'http://XXX/thread-19180-1-1.html';rn IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';rn poslist.Add('<em>post</em>time=');rn poslist.Add('formhash=469b4851');rn poslist.Add('subject=');rnrn poslist.Add('message=' + Edit2.Text);rn restr := IdHttp1.Post('http://XXX/forum.php?mod=<em>post</em>&action=reply&fid=12&tid=19180&extra=page%3D1&replysubmit=yes&infloat=yes&handlekey=fast<em>post</em>',poslist);rnrn
idhttp post aspx “500”问题
[code=Delphi(Pascal)]rnIdHTTP1.HandleRedirects:=true;rns.Add('__EVENTARGUMENT=');rn s.Add('__EVENTTARGET=btnSend');rn s.Add('__EVENTVALIDATION='+s1);rn s.Add('__VIEWSTATE='+s2);rn s.Add('txtKeyword='+Edit1.Text);rn Memo1.Text:=IdHTTP1.Post('http://dt.db.17173.com/xyj/default.aspx',s);rn[/code]rnrn怎么搞都报 500 前辈们来帮帮啊rn只有30分了!
idhttp post问题(在线等)
我现在想把'C:\Downloads下的sdasd.txt上传到服务器'http://192.168.1.2:80下rn下面是我找到的代码rnrnrnrnprocedure TForm1.Button2Click(Sender: TObject);rnvarrnresponseStream : TStringStream;rnmpfSource : TIdMultiPartFormDataStream;rnbeginrnmpfSource := TIdMultiPartFormDataStream.Create;rnresponseStream := TStringStream.Create('');rntryrnrnIdHTTP1.Request.ContentType := mpfSource.RequestContentType;rnrnmpfSource.AddFile('userfile', 'C:\Downloads\sdasd.txt', 'file');rnrnmpfSource.Position := 0;rnrnIdHTTP1.Post('http://192.168.1.2:80/sdasd.txt', mpfSource, responseStream);rnfinallyrn mpfSource.free;rn responseStream.free;rnend;rnend;rnrn每次执行都出错rnrnDebugger Exception Notificationrn---------------------------rnProject mail.exe raised exception class EIdHTTPProtocolException with message 'HTTP/1.1 405 Method not allowed'. Process stopped. Use Step or Run to continue.rn---------------------------rnOK Help rn---------------------------rnrn请问谁做过,可也指导下吗?rn
使用delphi XE的IdHTTP控件POST的例子
使用delphi XE的IdHTTP控件POST的例子,IDHTTP速度很快,是个不错的控件
delphi Idhttp控件post问题
[size=24px][b]木有authtoken,和origin参数[/b][/size]rn[img=https://img-bbs.csdn.net/upload/201905/03/1556896152_758378.jpg][/img]
提问:关于idhttppost问题
在用<em>idhttp</em>的<em>post</em>提交一个form的数据时,form中的submit有一个OnClick事件,在网页中,只有OnClick事件return true时,才执行submit,请问用<em>idhttp</em>怎么提交这样的form啊rnrnrn rn rn rn rn rnrn rn rn rnrn rn rn rn rnrnrnjavascript部分rn rnrn
delphi_rest与idhttppost提交
delphi_rest与<em>idhttp</em>的<em>post</em>提交
delphi idhttp 循环 Post
delphi <em>idhttp</em> 循环 Post
delphi idhttp post = 乱码
平台 :windows 7 rnIDE; delphi xe 5rnrn使用<em>idhttp</em>控件<em>post</em> 一个字符时,如果字符串里含有“=”号的话,再返回这个字符串的话,字符串里的“=”会变成 “3D”,怎么解决?
关于idhttp post的几个问题
感觉<em>idhttp</em><em>问题</em>很多rnrn1.在使用进度度显示上传进度时发现<em>idhttp</em>多次调用了workbegin事件(好像3次),多次显示上传进度rn2.上传速度很慢rnrn如何解决以上<em>问题</em>?
idhttp post例子
找了半天没有<em>post</em>例子,谁能发个,小弟学习下!!!rnrn小弟感激不尽啊!!!
idhttp 发送post失败。。。
我想发送一段这样的数据给192.168.0.1:9999端口rnPOST /test.asp?id=123456&ps=654321&str=我来做测试HTTP/1.0.. Connection: keep-alive..Content-Type: application/x-www-form-urlencoded..Content-Length: 4284..Host: 192.168.0.1:9999..Accept: text/html, */*..Accept-Encoding: identity..User-Agent: Mozilla/3.0 (compatible; Indy Library)rnrn[code=Delphi(Pascal)]rnServerUrl:= '192.168.0.1';rnGrStr:='我来做测试';rnParams := TStringList.Create;rnParams.Add('/test.asp?id=123456&ps=654321&str='+GrStr ) ;rnParams.Add('/test.asp?id==123456');rnParams.Add('&h=123456');rnParams.Add('&str='+GrStr);rn<em>idhttp</em>1.Port :=9999;rn<em>idhttp</em>1.Request.Connection :='keep-alive';rn<em>idhttp</em>1.Request.ContentType :='application/x-www-form-urlencoded';rn<em>idhttp</em>1.Request.Host :='192.168.0.1';rn<em>idhttp</em>1.Request.Accept :='text/html, */*';rn<em>idhttp</em>1.Request.AcceptEncoding :='identity';rn<em>idhttp</em>1.Request.UserAgent :='Mozilla/3.0 (compatible; Indy Library)';rnTestStr:=<em>idhttp</em>1.Post(ServerUrl , Params ); //到了这里就Socket Error 10061错误了。。。rn[/code]
idhttp控件的post编码问题
最近在做一个发贴工具,用的是delphi2010 indy10 ,论坛是discuz big5码,登陆没<em>问题</em>,但是发贴时,贴子内容是乱码。rn发贴函数如下:rnrnFunction TForm1.<em>post</em>info(url, subject, wsmessage,fid: string): Boolean;rnvarrnParam:TStringList;rngeturl:String;rn Response:TStringStream;rnbeginrnResult:=False;rngeturl:=url+'/index.php';rn//rnrn<em>idhttp</em>1.AllowCookies:=True;rn<em>idhttp</em>1.HandleRedirects:=True;rn//<em>idhttp</em>1.Request.Accept:='image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*';rn <em>idhttp</em>1.Request.Referer:=url+'/<em>post</em>.php?action=newthread&fid='+fid;rn IdHTTP1.HTTPOptions:=IdHTTP1.HTTPOptions+[hoKeepOrigProtocol];rn<em>idhttp</em>1.Request.AcceptLanguage:='zh-cn';rn<em>idhttp</em>1.Request.ContentType:='application/x-www-form-urlencoded' ;rn<em>idhttp</em>1.Request.AcceptEncoding :='gzip, deflate';rn<em>idhttp</em>1.Request.UserAgent:='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 2.0.50727)';rn <em>idhttp</em>1.Request.Connection:='keep-alive';rnrn <em>idhttp</em>1.Request.CacheControl:='no-cache';rnrnrnParam:=TStringList.Create;rnResponse:=TStringStream.Create('');rntryrnwsmessage:=ansitoutf8(wsmessage);rnparam.Clear;rnParam.Add('formhash='+formhash);rnparam.Add('wysiwyg=0');rnParam.Add('subject='+subject);rnParam.Add('message='+wsmessage);rnparam.Add('iconid=');rnparam.Add('addfeed=1');rnparam.Add('topicsubmit=%B5o%B7s%B8%DC%C3D');rn//Param.Add('userlogin=%E7%99%BB%E5%BD%95');rnurl:=url+'/<em>post</em>.php?action=newthread&fid='+fid+'&extra=&topicsubmit=yes';rntryrn <em>idhttp</em>1.Post(url,param,response); rn rn exceptrn showmessage('发贴失败');rn end;rnfinallyrn Param.Free;rn response.Free;rnend;rn showmessage(response.DataString);rnrnend;rn
IdHttp post 一个html
[b][color=#FF0000]HTML:[/color][/b]rn[code=HTML]rnrn 无标题页rnrnrn rn rn 用户:rn rn rn 密码:rn rn rn rn rn rn rn rn rn rn rnrnrn[/code]rnrnrn[color=#FF0000][b]ASP.NET[/b][/color]rn[code=C#]public partial class _info : System.Web.UI.Pagernrn protected void Page_Load(object sender, EventArgs e)rn rn string strName = Request.Form["user"];rn string strPwd = Request.Form["password"];rn Response.Write("user=" +strName);rn Response.Write(" ");rn Response.Write("password=" +strPwd);rn rn[/code]rnrnrn[b][color=#FF0000]请问用IdHttp如何提交数据?[/color][/b]rnrnrnrn
IdHttp重定向POST错误
设置HandleRedirects = true;rn向服务器发POST,被重定向,这时正确的方式是GET重定向网址,rn但是IdHttp竟然采用POST方式向重定向网址再次提交了用户名和密码,导致错误的返回rn我用的是Indy8.0,改为9.0就好了吗?
IDHTTP如何post 换行符?
一个很奇怪的<em>问题</em>,当我用<em>idhttp</em>来<em>post</em>一组数据的时候发现无法正确的提交换行和回车符。rn比如说我想<em>post</em>的数据未 a+换行+b 我想要的提交hex数据是 61 0D 0A 62,rn可是无论我设置成 'a'+#13+'b' 还是 'a'+#13+#10+'b' 或者 'a'+'#10'+'b'提交出去的hex数据都是 61 26 62,也就是说给提交成了a&b这样的数据了。rn请问谁知道如何来正确的提交换行+回车这样的符号!rn
idhttp post的xml的乱码问题
xml文件打开是这样的.rn rn- rn TestPay rn unified.trade.micropay rn 7551000001 rn lv170918103544 rnrn我用 TStrings LoadFromFile 后rn显示出来就变成这样了,, rnrnTestPayrnunified.trade.micropayrn7551000001rnlv170918103544rnrn我<em>post</em> 后,会返回Parse xml error,please use UTF-8 encoded
表单$_post[]的问题
<em>表单</em>action指向本身所在页面rn提交按钮rnrn下面有一个判断 if($_Get['search'])rn如果有值,说明点击了查询按钮,执行啥啥操作rn如果没有值,仅仅显示本页面静态部分。rnrn5.3可以运行rn使用PHP5.5之后却无法显示该网页rnrn请问解决办法吧。这是怎么回事?所有代码都需要重写?
xmlHttp post 表单问题
我按大家介绍的方法用XmlHttp对象<em>post</em><em>表单</em>,具体参照的内容在下面的网址上。rnhttp://school.enet.com.cn/document/20001218/2000121810241001.shtmlrn我在服务器端将数据保存到数据库中,但在request对象的form集合中无论如何也得不到发送的数据。rn多次调试之下,我将要发送数据直接加到bstrUrl变量后,在服务器端从request对象的rnQuestSting集合中获得了发送的数据。又发送了中文也未象文中所说出现乱码。rn不知老大们如何解释,我用的os 是win2000 sp4 e文版,ie6.0rnthank you!
post表单问题
我用方式阻止防止提交<em>表单</em>后跳转页面:rnrnrn rn rnrn我需要显示这个msg给用户,可以使alert()的格式,请问可以怎么做呢?(关键是,我怎么获取返回的msg)rnrn
struts和表单post问题
我又一个用<em>post</em>提交的form,提交到一个action处理,处理完成以后返回到index.jsp,由于index.jsp里面用tiles插入了一个servlet页面,然后我在定义tiles的地方用了urlController,但是为什么我在提交<em>表单</em>好以后index里面就显示不出servlet的内容,而光光调用index.jsp就没有<em>问题</em>呢?
VC post表单问题
我想做一个自动发布文章的VC程序,rn应用到了CInternetSession,现在已经成功实现了<em>表单</em>的发送,rnrn不过现在一个<em>问题</em>,rn比如发布的<em>表单</em>页面为:/fabu.asprn这个页面必须要求登录后才会显示的,/login.asp登陆后转到/fabu.asp。要是没有登录的话就会显示“登陆”或者“超时”rn这个估计是利用session来传递的rn现在POST自己需要的<em>表单</em>的时候,怎么能够获取一个登陆的session呢?或者POST的时候有没有办法能够打开发布<em>表单</em>的这个页面呢?rnrn谢谢大家!
idhttppost方法怎么用
我用delphi7中<em>idhttp</em>控件做一个自动登陆网页的程序。在<em>post</em>数据的时候总是出现一个“http1.1 /302 found”的错误。rn代码如下:rn procedure TForm1.Button1Click(Sender: TObject);rnrnbeginrn <em>post</em>str := tstringlist.Create;rn <em>post</em>str.add('username=XXXX');rn <em>post</em>str.add('password=XXXX');rn <em>post</em>str.add('utoLogin=true');rn <em>post</em>str.add('ourl=http%3A%2F%2Fwww.56.com%2F%3F8401');rn <em>idhttp</em>1.HandleRedirects := true;rn str := <em>idhttp</em>1.<em>post</em>('http://XXXXX.com/php/urs.php', <em>post</em>str);rn memo1.Text := system.UTF8Decode(str);rn <em>post</em>str.Free;rnend;rn如果把<em>idhttp</em>1.HandleRedirects := false;就出现“http/1.1 404”错误。rn同样抓包回来的数据用VB写的程序<em>post</em>的时候就没有<em>问题</em>,所以数据应该是没有<em>问题</em>的。
indy的idhttp中的post不行
<em>post</em>2.asp:rnrn response.Write ("form1="&request.Form ("form1"))rnrnrnC程序:rnrn TIdMultiPartFormDataStream* tData=new TIdMultiPartFormDataStream();rn TStringStream* ss=new TStringStream("");rnrnrn tData->AddFormField("form1","form1data");rnrn tData->Position=0;rnrn Form1->IdHTTP1->Request->ContentType=tData->RequestContentType;rnrn Memo1->Lines->Add(Form1->IdHTTP1->Post("/<em>post</em>2.asp",tData));rnrn ss->Seek(0, soFromBeginning);rn Memo1->Lines->Add(ss->DataString);rnrn delete ss;rn delete tData;rn Form1->IdHTTP1->Disconnect();rnrnrnrnrn//////////rnrn结果运行以后。显示form1=空,asp并没有收到东西,请问如何解决?rn因为数据量可能会很大,所以估计不能使用 url?字段=数据&.... 这种方式。。。。。
idhttppost数据,cookie的问题
这个网站的cookie是每次随机产生的。怎么<em>post</em>rnrn读取的话,怎么读
关于delphi idhttp post 与JSP 通信的问题
delphi 写了一个ocx文件,rn<em>idhttp</em>.<em>post</em>(url,inStream,reStream)发送数据, 发送的数据是文件。rnJSP端应该如何接收发送来的数据rn rnDELPHI 代码如下。rnrnrnvarrn Source: TMemoryStream;rn Source1: TMemoryStream;rn Response: TStringStream;rn S,s1: String;rnbeginrn Screen.Cursor := crHourGlass;rn IdAntiFreeze1.OnlyWhenIdle:=False;//设置使程序有反应.rn tryrnrn HTTP.Request.Username := '';rn HTTP.Request.Password := '';rn HTTP.Port := 80;rn HTTP.Request.ContentType := 'multipart/form-data';rn Response := TStringStream.Create('');rn tryrnrn S := '-----------------------------7cf1d6c47c' + CRLF +rn 'Content-Disposition: form-data; name="file1"; filename="'+FileName+'"'+CRLF +rn 'Content-Type: application/octet-stream' + CRLF + CRLF;rnrn //上传文件内容rn s1:='file one content. Contant-Type can be application/octet-stream or if'+rn 'you want you can ask your OS fot the exact type.' + CRLF +rn '-----------------------------7cf1d6c47c' + CRLF + //分界符,用于分隔<em>表单</em>(Form)中的各个域rn 'Content-Disposition: form-data; name="text1"' + CRLF + CRLF +rn 'hello2' + CRLF +rn '-----------------------------7cf1d6c47c--';rnrn //提交的下一个<em>表单</em>内容域的内容rn s1:=CRLF +'-----------------------------7cf1d6c47c' + CRLF +rn 'Content-Disposition: form-data; name="text1"' + CRLF + CRLF +rn 'hello2' + CRLF +rn '-----------------------------7cf1d6c47c--';rnrn Source := TMemoryStream.Create;rn Source1 := TMemoryStream.Create;rn Source1.LoadFromFile(FileName);rn Response:=TStringStream.Create('') ;rn Response.CopyFrom(source1,source1.Size);rnrn s:=s+Response.DataString;rn Source.Position :=0;rn Source.Write(s[1],length(s));rn Source.Position :=source.Size ;rn Source.Write(s1[1],length(s1));rn Response.Position :=0;rn tryrn HTTP.Post(URL, Source, Response);rn if pos('成功',response.datastring)<>0 thenrn Result := Truern elsern beginrn Result := Truern end;rn exceptrn Result := False;rn end;rn Source.Free;rn finallyrn Response.Free;rn end;rn finallyrn Screen.Cursor := crDefault;rn end;rnend;
idHttp的Post方法怎么用
idHttp的Post方法到底怎么用牙,那位高手能指教一下。rn我把数据Post传上去不行么rn我传了个txtUN=Admin&txtPW=123445&Submit=%CC%E1%BD%BB
使用IdHttp post方法一问
本人在开发delphi控件时使用IdHttp.Post(URL: string; const Source: TStrings; const AResponseContent: TStream)来提交到后台JAVA servlet进行处理,由于Source是自己组成的一个字符串,因此在服务器上获取该信息时无法获取用户的session信息,请问应该怎么样才能获取?
Idhttp发HTTP POST请求问题
rn在局域网用浏览器发HTTP POST 请求访问WEB服务器,速度很快,大致是几毫秒级的rn而在局域网用Idhttp发HTTP POST 请求访问WEB服务器,速度慢很多,200毫秒左右rnrn客户端Idhttp方式访问本机发布的WEB服务器,速度也同几毫秒,很快。rn客户端Idhttp方式访问局域网发布的WEB服务器,速度就降到200毫秒了rnrn请教各位大牛,rn怎样用DELPHI发HTTP POST请求,在局域网范围让速度控制在几十毫秒以下rnrn急急急,救命啊
求助:delphi7 IDhttp post https 问题
程序是模拟<em>post</em>登录 百度 . 登录后 在get 具体页面 登录到是成功了,每次get回来的源码 都是登录页面.rnrn我查了下.COOKIE不对. 如何获取https 的cookie?
idhttp post 参数 同时夹带 cookie 的问题
如果在 <em>post</em> 同时 把 COOKIE的内容一同发给服务器?rnrnrn网上找了好半天,特发帖求解。。。
急,Idhttp Post问题,在线等!
为什么发不了帖呢,返回 HTTP/1.0 200 OK rn为什么返回的版本是1.0呢rnrnprocedure TForm1.Post;rnconstrn BaseURL = 'http://bbs.it.com.cn/'; //地址rnvarrn IdHTTP: TIdHTTP;rn Params: TStrings;rn HTML: String;rnbeginrn idHTTP:= TidHTTp.create(self);rn Params := TStringList.Create;rn IdHTTP.AllowCookies := true;rn IdHTTP.HTTPOptions:=[hoForceEncodeParams];rn IdHTTP.ProtocolVersion := pv1_1;rn IDHTTP.Request.Accept:='*/*';rn IdHTTP.Request.Referer:='http://bbs.it.com.cn/ShowPost.aspx?TopicID=68696'; rn IdHTTP.Request.AcceptLanguage := 'zh-cn';rn IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded';rn IdHTTP.Request.AcceptEncoding := 'gzip, deflate';rn IdHTTP.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Alexa Toolbar; 56flvplayer 1.0)';rn IdHTTP.Request.Host := 'bbs.it.com.cn';rn IdHTTP.Request.ContentLength := length(Edit1.Text);rn IdHTTP.Request.Connection := 'Keep-Alive';rn IdHTTP.Request.CacheControl := 'no-cache';rn Params.Add('message='+Edit1.Text);rn tryrn HTML:=IdHttp.Post(BaseURL+'ShowPost.aspx?TopicID=68696',Params);rn exceptrn showmessage('error'); rn exit; rn end;rn Memo1.Text := IdHttp.ResponseText;rn IdHTTP.Disconnect;rn FreeAndNil(IdHTTP);rn FreeAndNil(Params);rnend; rn
Indy的idHttp组件多线程POST问题,请教
想用INDY的 IDHTTP组件实现对网页多线程POST,无奈IDTCPSERVER有多线程DEMO,找不到<em>idhttp</em>的DEMO,自己尝试多天未果,不知哪位朋友可以支招,最好详细一点,在多线程方面,我没有任何经验.如果有完整DEMO,将另开贴加100分.
怎样用IdHTTP进行POST操作?
如题。
Idhttp控件,POST不能登录
以下这段代码,在登录有的网站时是可以的,但登录某网站时却不行,当然用户名和密码的参数不同,也改了。rn代码如下:rn[code=Delphi(Pascal)]procedure TForm1.Button1Click(Sender: TObject);rnvarrn b:string;rn Params: TStrings;rnbegin rn idHTTP1:= TidHTTp.create(self);rn Params := TStringList.Create;rn IdHTTP1.AllowCookies := true; //启用cookiern idHTTP1.HandleRedirects := true; //开启自动跳转,也就是302rn IdHTTP1.HTTPOptions := IdHTTP1.HTTPOptions + [hoKeepOrigProtocol];rn IdHTTP1.ProtocolVersion := pv1_1;rn IDHTTP1.Request.Accept:='image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/QVOD, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD,*/*';rn IdHTTP1.Request.Referer:='http://www.target.com/member/member_login_ok.asp';rn IdHTTP1.Request.AcceptLanguage := 'zh-cn';rn IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';rn IdHTTP1.Request.AcceptEncoding := 'gzip, deflate';rn IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727)';rn IdHTTP1.Request.Host := 'www.target.com';rn IdHTTP1.Request.Connection := 'Keep-Alive';rn IdHTTP1.Request.CacheControl := 'no-cache';rn Params.Add('bef_url=before_ok_url');rn Params.Add('LoginID='+Edit1.Text);rn Params.Add('szPasswd='+Edit2.Text);rn IdHTTP1.Request.ContentLength := length(Params.text);rn rnrn <em>idhttp</em>1.Request.SetHeaders;rn idHTTP1.Request.CustomHeaders.Text:='Cookie: shop=main=%2Fmain%2Easp; MEMBER=PASSCNT=0&IDCNT=0; IDPASS=SESSION=0; ASPSESSIONIDSCRCSSCB=PAPPKGFDMFCFOFJMLANFBPHH ';rnrn b:=IdHTTP1.Post('http://www.target.com/member/member_login_ok.asp',Params);rn Memo1.Text:=b;rnrnend;rnrnrnend.[/code]rnrn用delphi发提交时的数据包rnrnPOST /member/member_login_ok.asp HTTP/1.1rnConnection: Keep-AlivernContent-Type: application/x-www-form-urlencodedrnContent-Length: 58rnCache-control: no-cachernCookie: shop=main=%2Fmain%2Easp; MEMBER=PASSCNT=0&IDCNT=0; IDPASS=SESSION=0; ASPSESSIONIDSCRCSSCB=PAPPKGFDMFCFOFJMLANFBPHH rnHost: www.target.comrnAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/QVOD, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD,*/*rnAccept-Encoding: gzip, deflaternAccept-Language: zh-cnrnReferer: http://www.target.com/member/member_login_ok.asprnUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727)rnrnbef_url=before%5Fok%5Furl&LoginID=testuser&szPasswd=123456&rnrnrn在网页登录时的数据包rnrnPOST /member/member_login_ok.asp HTTP/1.1rnAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/QVOD, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD, */*rnReferer: http://www.target.com/member/member_login_ok.asprnAccept-Language: zh-cnrnContent-Type: application/x-www-form-urlencodedrnAccept-Encoding: gzip, deflaternUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727)rnHost: www.target.comrnContent-Length: 53rnConnection: Keep-AlivernCache-Control: no-cachernCookie: shop=main=%2Fmain%2Easp; MEMBER=PASSCNT=0&IDCNT=0; IDPASS=SESSION=0; ASPSESSIONIDSCRCSSCB=PAPPKGFDMFCFOFJMLANFBPHHrnrnbef_url=before_ok_url&LoginID=testuser&szPasswd=123456
idhttp如何post xml数据,
Postxml:= Tstringlist.create;rn Postxml.Add('');rn Postxml.Add('');rn Postxml.Add('');rn <em>idhttp</em>.<em>post</em>(host,<em>post</em>xml);rn这样<em>post</em>的数据会变成 &&的格式,rnrn rn rn rn怎样<em>post</em>成上面格式的数据,
IdHTTP控件的post问题,求助(急用)
procedure Post(URL: string; const Source: TStrings; const AResponseContent: TStream) rn第三个参数是返回什么值的?是用什么表示的?另附一段简单代码,是向一个网页传递信息的,请高手看下是否可以这样传递?rn String sendtxt=“jksdljklasjdl”;rn TMemoryStream *ms=new TMemoryStream;rn TStringList *sl= new TStringList; rn sl->Add(sendtxt);rn IdHTTP1->Post("http://einfo.infoma.com/customer/add", sl,ms);rn delete sl;rn delete ms;rn我是否可以用变量ms来判断发送是否成功,应该如何判断?还有<em>post</em>的字段是否有什么固定格式?rn新手急用,各位高手帮忙了,先谢谢
post 表单
<em>表单</em>信息如下:rnrn rn --用户名rn --接口类型rn --订单号rnrnrn如何用<em>post</em>的方式传递和接收<em>表单</em>信息
jquery 自动 post 表单问题
做了一个单点登录的功能,另一个系统把用户名密码提交过来的时候, 调用$("form").submit();但是登录不成功,还得重新输入密码。但是,点击登录按钮(submit)的时候,就可以登录成功! rn是不是不能自动<em>post</em><em>表单</em>?必须通过按钮触发事件<em>post</em><em>表单</em>么?rn
模拟POST表单的神奇的问题
[code=c]rn CString strFormData = "uname=****&upass=****"; // 需要提交的数据rn CInternetSession sess((LPCTSTR)"My Session",0);rn CHttpFile* fileGet;rn CString strHeaders = "Content-Type: application/x-www-form-urlencoded"; // 请求头rnrn tryrn rn CHttpConnection* pConnection = sess.GetHttpConnection( "192.168.15.80:8080" ); rn fileGet = pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, "/navigation/check?act=in");rn rnrn CString strSentence = "";rn CString strGetSentence = "";rn if(fileGet)rn rn fileGet->SendRequest(strHeaders, (LPTSTR)(LPCTSTR)strFormData, strFormData.GetLength());rn while(fileGet->ReadString(strSentence)) // 读取提交数据后的返回结果rn rn strGetSentence += strSentence + char(13) + char(10);rn rn coutClose();rn delete pConnection;rn pConnection = NULL;rn rn rn catch(CException* e)rn rn fileGet = 0;rn e->ReportError();rn e->Delete();rn [/code]rn 我的代码水平一般,上面代码有一个<em>问题</em>是这样:rn如果不打开fiddler这个抓包工具,它运行提示“无法与服务器建立连接”,打开抓包工具之后能够正常rn返回<em>post</em>请求之后收到的数据,请大神帮忙给看看是哪的<em>问题</em>。
关于刷新POST表单问题
现有一<em>表单</em>页面(POST方式提交),当用户没有填完相应信息,想重新填值时,习惯性的点击浏览器的“刷新”按钮,而不是去点页面上已有的“重置”按钮,这时浏览器就会提示 是否重复提交 的提示,这样显得很不人性化,这时应该提示“确实要离开本页面吗?离开将丢失所有内容!”,大家是怎样去实现的呢?如果将页面<em>表单</em>提交方式改为GET就会有一大堆参数,又显得不够安全。。。有哪位大虾能给点思路吗?
VC中Post表单问题
有一个网站http://www.zhulang.com/,小说站点,我想要用VC提取我指定的一部小说的内容,比如金庸的《鹿鼎记》,我现在要提交POST<em>表单</em>,我的程序代码如下,返回不正确,我的代码可能是头文件写错了,哪位高手帮我看看:这个头文件怎么写?rnCHttpDownDemoDlg *pDlg=(CHttpDownDemoDlg*)lpParam;rn CString strRequest="";rn //strRequest+=pDlg->m_name;rn strRequest+="action=action&key=鹿鼎记"; //这里写错了吧??哪位高手给看看,这个头文件该怎么写??谢谢rn CString strServerName="www.zhulang.com";rn CString strObjectName="/search.php";rn INTERNET_PORT nPort=80;rn CString strResponse="";rn CInternetSession session("HttpSession");rn CHttpConnection *pServer=NULL;rn CHttpFile *pFile=NULL;rn tryrn rn pServer=session.GetHttpConnection(strServerName,nPort);rn pFile=pServer->OpenRequest(0,strObjectName);rn char szHeaders[100];rn memset(szHeaders,0,sizeof(szHeaders));rn strcpy(szHeaders,"Accept: text*//*\r\nContent-Type: application/x-www-form-urlencoded");rn pFile->AddRequestHeaders(szHeaders);rn rn pFile->SendRequestEx(strRequest.GetLength());rn pFile->WriteString(strRequest);rn pFile->EndRequest();rn DWORD dwRet=0;rn pFile->QueryInfoStatusCode(dwRet);rn rn char szBuf[1024];rn memset(szBuf,0,sizeof(szBuf));rn if(dwRet!=HTTP_STATUS_OK)rn rn UINT nRead;rn do rn rn nRead=pFile->Read(szBuf,1023);rn if(nRead!=0)rn rn szBuf[nRead]=0;rn strResponse+=szBuf;rn rn while(nRead!=0);rn rn delete pFile;rn delete pServer; rn rn catch(CInternetException *pEx)rn rn AfxMessageBox("ÍøÂçÒì³££¬ÇëÏȼì²âÍøÂ磡");rn rn AfxMessageBox(strResponse);rnrn哪位大侠给看看??
HTTP中表单POST的问题
做WEBSERVER,接受用POST来传递<em>表单</em>时候,<em>表单</em>数据是跟在HTTP请求头后面的,但是当我发现<em>表单</em>数据过大时,<em>表单</em>数据就不跟在HTTP请求头后面了,我该怎么获取<em>表单</em>数据呢??rnrn(C/C++)
IDHTTP问题
为什么我用IDHTTP组件下载.ocx文件没有<em>问题</em>,而下载fastreport文件(.frf)去下不下来,大小总是0。rnrn我的服务器环境:windows 2000 prefessional
IdHttp的问题
void __fastcall TForm1::Button1Click(TObject *Sender)rnrn AnsiString strURL = "ftp://dy.xxjy.org:2212/连续剧/[20070626]谢谢你曾经爱过我/谢谢你曾经爱过我10.rmvb";rn TMemoryStream *sUpd;rn IdHTTP1->Head(strURL);rn sUpd=new TMemoryStream;rn try rn rn IdHTTP1->Get(strURL, sUpd);rn rn catch(...)rn rn ShowMessage("升级失败!请检查网络连接是否通畅。"); rn delete sUpd; rn return; rn rn sUpd->SaveToFile("10.rmvb");rn delete sUpd;rnrnrn1,IdHTTP1->Head(strURL);这句是必须的吗?什么作用?rn2,这样下载,岂不是先将网上的东西移到内存,然后再从内存移到硬盘,如果是很大的文件怎么办?rn3,如果是ftp文件是不是跟这个<em>idhttp</em>控件用法一样呀rn4,如何断点续传,就像迅雷那样rn5,如何多线程下载,怎样拼接文件.rnrn大侠们,能回答几个就回答几个吧.rn
Delphi 2007下,idhttp post重定向地址错误?
Delphi 2007 + Indy 9.0.18rnrn重定向后的地址是 http: rnrn你没看错,就5个字符 http: 重定向后<em>idhttp</em>就<em>post</em>这地址。。。郁闷rnrn可我用D7的程序就很正常啊!,怎么回事
idhttp post 如何登陆百度? 高分请教
<em>idhttp</em> <em>post</em> 如何登陆百度?rnrnrnrn就是想 用 <em>post</em> 登陆 一个有用户名的网站rnrn例如百度 rnrn请给个例子 高分请教
IdHttp问题
我在用<em>post</em>方法,打开一个带参数的网址时,提示错误,错误信息如下:rn“HTTP/1.1 500 Internal Server Error.”,但是我在IE浏览器下,是可以的呀,各位大虾,能够帮帮忙吗?谢谢!
idhttp问题
用<em>idhttp</em>做下载的,当<em>idhttp</em>1一个在下载时,又生成一个<em>idhttp</em>2下载的时候,第一次就不下载了,只有到了第二个下载完了之后,第一个才继续下载,这是什么原因。在线等,谢谢
Idhttp Post数据后投票显示未登陆
通过http://passport.mop.com/已经用<em>idhttp</em> <em>post</em>使帐户登陆成功rn但是在比如:http://adidas-ase.mop.com/person.jsp?id=8398这个页面,使用<em>idhttp</em>.<em>post</em>模拟投票的时候显示未登陆rn感觉应该是COOKIE的<em>问题</em>.郁闷呢~~~就一个COOKIE弄了好长时间,也不知道怎么搞.rn希望知道的朋友给个解决的办法,谢谢了~~
idhttp post 实例 不知道哪位大侠有
[color=#FF0000]delphi code[/color] rnrnprocedure TForm1.Button3Click(Sender: TObject);rnvarrnres,ret:tstringstream;rnsends:tstringlist;rnbeginrn res:=TStringStream.Create('');rn ret:=TStringStream.Create('');rn IdHTTP1 :=TIdHTTP.Create(nil);rn sends:=tstringlist.Create;rn res.WriteString('nick=name');rn res.WriteString('fasdf=ndafdasfdsaf');rn sends.Clear;rn sends.Add('txt_name=name');rn sends.Add('&txt_password=name');rn IDHttp1.HandleRedirects := true;rn IdHTTP1.request.contenttype:='application/x-www-form-urlencoded';rnrn showmessage(res.DataString);rn showmessage(sends.GetText);rn IdHTTP1.ProtocolVersion:=pv1_1;rn IdHTTP1.get('xxxxxx.asp',res);rn showmessage(<em>idhttp</em>1.Response.ResponseText);rn IdHTTP1.<em>post</em>('xxxxx.asp',sends,ret);rn showmessage(ret.DataString);rnrn ret.Free;rn sends.Free;rn res.Free;rn <em>idhttp</em>1.Free;rnend;rnrnrn[color=#FF0000]asp code [/color]rnrn For Each x In Request rn if x<>"submit" thenrn flist1=flist1&x&","rn values1=values1&"'"&Request(x)&"',"rn end ifrn response.write(FLIST1&values1) rn Nextrn
【转载】Delphi Idhttp的get和post方法
Post var Param:TStringList; RStream:TStringStream; begin Param:=TStringList.Create; RStream:=TStringStream.Create(''); Param.Add('username=showlee000'); Param.Add('norm...
idhttp post注册网站 总返回200
好心人帮助下 小弟感激不尽。rn盛大注册账号,抓包看到COOKIE不一样,是不是要组合COOKIE,还有那个提交按钮代码里用中文,抓包显示“.....”几个点,不知是不是这<em>问题</em>,但我不知怎么解决,只好抓包里的复制过来。rncode:rnrnconstrn hosturl = 'http://register.sdo.com/PTNew/index.aspx';//盛大注册网页,用第一个方式注册rnprocedure TForm3.btn1Click(Sender: TObject);rnvarrn SurfUrl, tmpstr: string;rn stra, SessionID, sessionc,viewstate,EVENTVALIDATION: string;rn i: Cardinal;rn p2: TStrings;rn Params, backdata:TStringStream;rnbeginrn mmo1.Clear;rn Params := TStringStream.Create;rn p2 := TStringList.Create;rn httpp1 := t<em>idhttp</em>.Create(self);rnrn backdata:=TStringStream.Create;rn with httpp1 dorn beginrn Disconnect;rn Get(hosturl,backdata);rn //SessionID getrn for i := 0 to Response.RawHeaders.Count - 1 dorn if Pos('Set-Cookie: ASP.NET_SessionId=', Response.RawHeaders[i]) > 0 thenrn beginrn SessionID := Trim(Copy(Response.RawHeaders[i], 31, maxint));rn SessionID := Copy(SessionID, 1, Pos(';', SessionID) - 1);rn Break;rn end;rn stra := Response.CustomHeaders.Values['Set-Cookie'];rn /// viewstate getrn i:=Pos('id="__VIEWSTATE"', backdata.DataString );rn if i>0 thenrn beginrn viewstate:= Copy(backdata.DataString, i+24, 105);rn viewstate:= Copy(viewstate, 1, Pos('"', viewstate)-1 );rn end;rn //get EVENTVALIDATIONrn i:=Pos('id="__EVENTVALIDATION"', backdata.DataString );rn if i>0 thenrn beginrn EVENTVALIDATION:= Copy(backdata.DataString, i+30, 195);rn EVENTVALIDATION:= Copy(EVENTVALIDATION, 1, Pos('"', EVENTVALIDATION)-1 );rn end;rn end;rn backdata.Free;rn SurfUrl :=rn 'http://register.sdo.com/PTNew/ExistPtid.ashx?username=' + edtUser.Text +rn '&sid='+SessionID+'&new=1';rn stra := httpp1.Post(SurfUrl, p2);rn edt1.Text:=stra;rnrn Params.Clear;rn Params.WriteString(rn '__VIEWSTATE='+viewstate);rn Params.WriteString('&ioBB=');rn Params.WriteString('&regsdid=');rn Params.WriteString('&chksdid=false');rn Params.WriteString('&hidRecName001=');rn Params.WriteString('&hidRecName002=');rn Params.WriteString('&hidRecRule001=');rn Params.WriteString('&hidRecRule002=');rn Params.WriteString('&agent4IpCheck=checkIp');rn Params.WriteString('&txtRegisterFrom=0');rn Params.WriteString('&txtRegisterZone=0');rnrn Params.WriteString('&sessionid=' + SessionID); // 2009/11/8 12:53:19 http://www.sdo.com/IndexIframeLogin.asprn Params.WriteString('&goldtype=');rn Params.WriteString('&partner=');rn Params.WriteString('&apptype=');rn Params.WriteString('&agent=');rn Params.WriteString('&ctype=');rn Params.WriteString('&hidExinfo=');rn Params.WriteString('&qqaccount=');rn Params.WriteString('&CUSTOM_REG_EVN=');rn Params.WriteString('&cus_field_1=');rn Params.WriteString('&cus_field_2=');rn Params.WriteString('&cus_field_3=');rn Params.WriteString('&ui_type='); Params.WriteString('&cus_section_1=');rn Params.WriteString('&ptType=0');rn Params.WriteString('&username=' + edtUser.Text);rn Params.WriteString('&UserEmailId=');rn Params.WriteString('&UserEmail139Id=');rn Params.WriteString('&UserCellphoneId=');rn Params.WriteString('&password=111222a');rn Params.WriteString('&repassword=111222a');rn Params.WriteString('&PTUserEmailId=');rn Params.WriteString('&mobile=');rn Params.WriteString('&PromoterID=');rn Params.WriteString('&realname=');rn Params.WriteString('&idcard=');rn Params.WriteString('&birthday=');rn Params.WriteString('&phone=');rn Params.WriteString('&ddlQuestion1=');rn Params.WriteString('&question1=');rn Params.WriteString('&answer1=');rn Params.WriteString('&ddlQuestion2=');rn Params.WriteString('&question2=');rn Params.WriteString('&answer2=');rn Params.WriteString('&attcode2=123456');rn Params.WriteString('&chkAgreement=1');rn Params.WriteString(rn '&btnSubmit=%B4%B4%BD%A8%CE%D2%B5%C4%CA%A2%B4%F3%CD%A8%D0%D0%D6%A4');rn Params.WriteString(rn '&__EVENTVALIDATION='+EVENTVALIDATION);rnrn with httpp1 dorn beginrn // Request.CustomHeaders.Clear;rn Request.CacheControl := 'no-cache';rn AllowCookies := true;rn HTTPOptions := [hoForceEncodeParams];rn ProtocolVersion := pv1_1;rn HTTPOptions := HTTPOptions + [hoKeepOrigProtocol];rnrn Request.Accept :=rn 'image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash,' + ' application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/QVOD, application/QVOD, */*';rn Request.AcceptLanguage := 'zh-CN';rn Request.UserAgent :=rn 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)';rn Request.Connection := 'Keep-Alive';rn Request.AcceptEncoding := 'gzip, deflate';rn Request.Host := 'register.sdo.com';rn Request.ContentLength := Length(Params.ToString);rn Request.Referer := 'http://register.sdo.com/PTNew/index.aspx?';rn //Request.From:= 'http://register.sdo.com/PTNew/index.aspx?from=0';rn // HandleRedirects := true;rn Request.ContentType := 'application/x-www-form-urlencoded';rn end;rn tryrn // getcook;rn tmpstr := httpp1.Post(hosturl, Params);rn // Application.ProcessMessages;rn finallyrn mmo1.Text := httpp1.ResponseText;rn mmo1.Lines.add(tmpstr);rn end;rn httpp1.Disconnect;rn FreeAndNil(httpp1);FreeAndNil(Params);rnend;
我要idhttp post 登录这个网址
我要<em>idhttp</em> <em>post</em> 登录这个网址 rn https://login.plaync.co.kr/login/login/login.asprnrnrn求高手代码 分不够追击给你
IDHTTP 问题
在 一个线程中,用<em>idhttp</em>发生了错误!具体如下:rnrnurl:=my<em>idhttp</em>.Get('http://www.my.com/myfile.php');//发生异常rnrn发生 #10060 connection time out 错误,rnmy<em>idhttp</em> 是在线程中创建的 create(nil)rnhttp://www.my.com/myxml.php 是把数据库中的文件生成xml文件的rnrn请问 是什么原因?和怎样解决(最主要)
post表单递交
我想在vb中用inet实现自动登陆www.chinaren.comrn请问用<em>post</em>怎么实现??rnrn如何知道已经<em>post</em>成功
Post 表单 添加字段
如 https://login.globalsources.com/sso/GeneralManager?action=Login&rand=1294291040246rnrn这个页面, 登录提交后, 会在<em>post</em> <em>表单</em>中增加 X, Y 字段; rnrn可是我即没有在 html 中发现这两个字段, 也没看到实现相应功能的js, 请高手分析他们到底是如何实现的?rn
MsMultiPartFormDataStream post表单出错
[code=text]rnprocedure TForm1.Button4Click(Sender: TObject);rnvarrn url,fankui: string;rn stream: TStringStream;rn data: TMsMultiPartFormDataStream;rn ResponseStream: TMemoryStream;rnbeginrn url:='http://127.0.0.1/dede/article_add.php';rn data := TMsMultiPartFormDataStream.Create;rn memo1.Clear;rn memo1.Lines.add(utf8encode((StripHTML(decontent)+depic+degmap)));rn //exit;rn stream:= TStringstream.Create('');rn ResponseStream := TMemoryStream.Create;rn tryrn IdHttp1.Request.ContentType := data.RequestContentType;rn data.AddFormField('title', Utf8encode(detopic));rn data.AddFormField('body',Utf8encode(decontent));rn data.AddFormField('typeid','38');rn data.AddFormField('channelid','1');rn rn data.PrepareStreamForDispatch;rn data.Position := 0;rn IdHTTP1.Post(url, data, ResponseStream);rn responsestream.SaveToStream(stream);rn fankui:= utf8toansi(stream.DataString);rn memo1.Clear;rn Memo1.Lines.Add(fankui);rn rn finallyrn data.Free;rn ResponseStream.Free;rn end;rnrnend;[/code]rndecontent包含
IdHTTP的问题
怎么获得cookie 值啊?rnrn还有 比如 我在 post 一个网页的时候,还有一些cookie怎么设置啊? rn 谢谢了, 最好能带一些带码 :)
c语言练习113道下载
c语言巩固练习,分好类,全部都排好版,可以先看哪一题直接选题号就可以 相关下载链接:[url=//download.csdn.net/download/ivanhui0314/4022576?utm_source=bbsseo]//download.csdn.net/download/ivanhui0314/4022576?utm_source=bbsseo[/url]
C++ AMP下载
C++ AMP 相关下载链接:[url=//download.csdn.net/download/augusdi/6508515?utm_source=bbsseo]//download.csdn.net/download/augusdi/6508515?utm_source=bbsseo[/url]
解析excel文件下载
根据你指定的路径去解析相对应的excel文件。 相关下载链接:[url=//download.csdn.net/download/csdnjavaliwei/8272965?utm_source=bbsseo]//download.csdn.net/download/csdnjavaliwei/8272965?utm_source=bbsseo[/url]
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法
我们是很有底线的