idhttp问题,网页信息 ( 积分: 100 )

  • 主题发起人 主题发起人 ccdarkness
  • 开始时间 开始时间
C

ccdarkness

Unregistered / Unconfirmed
GUEST, unregistred user!
下面是我要做的一个搜索工具,也就是不用登录网站查看http://0daycheck.eastgame.net/0day/search.php搜索出来的软件信息,前面的都做好了,但是到下面我标记的地方有问题!!<br><br>unit TLF0DAY;<br><br>interface<br><br>uses<br> &nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> &nbsp;Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,<br> &nbsp;IdHTTP, StdCtrls, SUIEdit, ExtCtrls, SUIForm, SUIButton, SUIProgressBar,<br> &nbsp;SUIListBox, SUIMemo;<br><br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp; &nbsp;IdHTTP: TIdHTTP;<br> &nbsp; &nbsp;suiForm1: TsuiForm;<br> &nbsp; &nbsp;se1: TsuiEdit;<br> &nbsp; &nbsp;sb1: TsuiButton;<br> &nbsp; &nbsp;slb: TsuiListBox;<br> &nbsp; &nbsp;sm1: TsuiMemo;<br> &nbsp; &nbsp;procedure sb1Click(Sender: TObject);<br> &nbsp; &nbsp;procedure se1KeyPress(Sender: TObject; var Key: Char);<br> &nbsp; &nbsp;procedure slbClick(Sender: TObject);<br> &nbsp;private<br> &nbsp; &nbsp;{ Private declarations }<br> &nbsp;public<br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br><br>var<br> &nbsp;Form1: TForm1;<br> &nbsp;filenfo:array of string;<br> &nbsp;filename:array of string;<br> &nbsp;addline:array of string;<br>implementation<br><br>{$R *.dfm}<br>{*大家帮看看,为什么会在这里出错!我在&quot;tempp:=.... &quot;这里下<br>了断点,发现程序到这里之前是没有错的,再执行下去就出现<br>“http/1.1 404 not found错误提示,但是那个网页明明存在的,也不应该是重定向问题”<br>*}<br>procedure getdown;<br>var<br>begin4,end4:integer;<br>tempp,adddown:string;<br>begin<br>tempp:=form1.IdHTTP.get('http://0daycheck.eastgame.net'+trim(form1.addline[slb.ItemIndex]));<br>begin4:=pos('TLF 0Day Public FTP Server',tempp)+26;<br>end4:=pos('&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;',tempp);<br>adddown:=copy(tempp,begin4,end4-begin4);<br>form1.sm1.Lines.Add(adddown);<br>end;<br><br><br><br>procedure getcode;<br>var<br> &nbsp;i, j, begin1, begin2,begin3, end1, end2,end3: integer;<br> &nbsp;surl, ppp, entries: string;<br> &nbsp;p:dword;<br>begin<br>try<br>begin<br> &nbsp;Form1.slb.Clear;<br> &nbsp;ppp := Form1.se1.Text;<br> &nbsp;for i := 1 to length(ppp) do<br> &nbsp; &nbsp;surl := surl + '%' + inttohex(ord(ppp), 2);<br> &nbsp;ppp := Form1.IdHTTP.Get('http://0daycheck.eastgame.net/0day/search.php?tlf0dayteam%5BsearchTerm%5D=' + surl);<br> //*******************************打开搜索页面,ppp保存搜索结果的页面代码************************************<br><br> &nbsp;begin2 := pos('totalling ', ppp) + 10;<br> &nbsp;end2 := pos(' entries', ppp);<br> &nbsp;entries := copy(ppp, begin2, end2 - begin2); //获取搜索文件的总数<br><br> &nbsp;setlength(addline, strtoint(entries)); //页面动态数组<br> &nbsp;setlength(filename, strtoint(entries)); //软件名称数组<br> &nbsp;setlength(filenfo, strtoint(entries));<br><br> &nbsp;while pos('tlf0dayteam_title', ppp) &lt;&gt; 0 do<br> &nbsp;begin<br> &nbsp; &nbsp;delete(ppp, pos('tlf0dayteam_title', ppp), 4);<br> &nbsp; &nbsp;j := j + 1;<br> &nbsp;end; //计算需要循环几次<br><br><br> &nbsp;for i := 0 to j-1 &nbsp;do<br> &nbsp;begin<br> &nbsp; &nbsp;begin1 := pos('itle&quot;&gt;&lt;a href=&quot;', ppp) + 15; //获取下载开始位置<br> &nbsp; &nbsp;end1 := pos('.html&quot;&gt;', ppp); //结束下载位置<br> &nbsp; &nbsp;addline := copy(ppp, begin1, (end1 - begin1 + 5)); //得到下载页面位置<br> &nbsp; // Form1.slb.Items.Add(addline);<br><br>//****************************************获取软件页面地址,保存在数组addline中***************************<br><br> &nbsp; &nbsp;begin2 := pos(addline, ppp) + length(addline); //获取软件名称开始位置<br> &nbsp; &nbsp;end2 := pos('&lt;/a&gt;&lt;/h4&gt;', ppp); // 软件名称结束位置<br> &nbsp; &nbsp;filename := copy(ppp, begin2 + 2, (end2 - begin2-2));<br> &nbsp; &nbsp;filename:=StringReplace(filename,'&lt;br /&gt;',' &nbsp;| EN: | &nbsp;',[rfIgnoreCase]);<br> &nbsp; &nbsp;Form1.slb.Items.Add(filename);<br><br>//***************************************获取软件名称,保存在数组filename中*******************************<br> &nbsp; &nbsp;begin3:=pos('&lt;div class=&quot;tlf0dayteam_entry&quot;&gt;',ppp)+31;<br> &nbsp; &nbsp;end3:=pos('&lt;div class='+#39+'tlf0dayteam_entryFooter'+#39+'&gt;',ppp);<br> &nbsp; &nbsp;filenfo:=copy(ppp,begin3,end3-begin3);<br> &nbsp; &nbsp;//form1.slb.Items.Add(filenfo);<br>//****************************************软件信息,保存在数组<br> &nbsp; &nbsp;end2:= pos('&lt;/a&gt;&lt;/h4&gt;', ppp);<br> &nbsp; &nbsp;delete(ppp, end2, 7);<br> &nbsp; &nbsp;delete(ppp, begin1 - 15, 15);<br> &nbsp; &nbsp;end1 := pos('.html&quot;&gt;', ppp);<br> &nbsp; &nbsp;delete(ppp, end1, 7);<br> &nbsp; &nbsp;end1 := pos('.html&quot;&gt;', ppp);<br> &nbsp; &nbsp;delete(ppp, end1, 7);<br> &nbsp; &nbsp;begin3:= pos('&lt;div class=&quot;tlf0dayteam_entry&quot;&gt;',ppp)+31;<br> &nbsp; &nbsp;delete(ppp,begin3-31,31);<br> &nbsp; &nbsp;end3:=pos('&lt;div class='+#39+'tlf0dayteam_entryFooter'+#39+'&gt;',ppp);<br> &nbsp; &nbsp;delete(ppp,end3,30);<br> &nbsp; &nbsp;//Form1.sm1.Clear;<br> &nbsp; &nbsp;//Form1.sm1.Lines.Add(ppp);<br> &nbsp;end;<br> &nbsp;end;<br> &nbsp;finally<br> &nbsp;end;<br>end;<br><br><br>procedure TForm1.sb1Click(Sender: TObject);<br>var<br> &nbsp;id: dword;<br>begin<br> &nbsp;createthread(nil, 0, @getcode, nil, 0, id);<br>end;<br><br>procedure TForm1.se1KeyPress(Sender: TObject; var Key: Char);<br>begin<br> &nbsp;if Key = chr(13) then<br> &nbsp; &nbsp;Form1.sb1.Click;<br>end;<br><br>procedure TForm1.slbClick(Sender: TObject);<br>var<br>i:integer;<br>j:dword;<br>begin<br>sm1.Clear;<br>i:=slb.ItemIndex;<br>if pos('&lt;br /&gt;',filenfo)&lt;&gt;0 then<br>begin<br>filenfo:=copy(filenfo,1,pos('&lt;br /&gt;',filenfo)-1);<br>sm1.Lines.Add(filenfo);<br>end<br>else<br>sm1.Lines.Add(filenfo);<br>showmessage(addline);<br>createthread(nil, 0, @getdown, nil, 0, j);<br>end;<br><br><br>end.
 
下面是我要做的一个搜索工具,也就是不用登录网站查看http://0daycheck.eastgame.net/0day/search.php搜索出来的软件信息,前面的都做好了,但是到下面我标记的地方有问题!!<br><br>unit TLF0DAY;<br><br>interface<br><br>uses<br> &nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> &nbsp;Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,<br> &nbsp;IdHTTP, StdCtrls, SUIEdit, ExtCtrls, SUIForm, SUIButton, SUIProgressBar,<br> &nbsp;SUIListBox, SUIMemo;<br><br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp; &nbsp;IdHTTP: TIdHTTP;<br> &nbsp; &nbsp;suiForm1: TsuiForm;<br> &nbsp; &nbsp;se1: TsuiEdit;<br> &nbsp; &nbsp;sb1: TsuiButton;<br> &nbsp; &nbsp;slb: TsuiListBox;<br> &nbsp; &nbsp;sm1: TsuiMemo;<br> &nbsp; &nbsp;procedure sb1Click(Sender: TObject);<br> &nbsp; &nbsp;procedure se1KeyPress(Sender: TObject; var Key: Char);<br> &nbsp; &nbsp;procedure slbClick(Sender: TObject);<br> &nbsp;private<br> &nbsp; &nbsp;{ Private declarations }<br> &nbsp;public<br> &nbsp; &nbsp;{ Public declarations }<br> &nbsp;end;<br><br>var<br> &nbsp;Form1: TForm1;<br> &nbsp;filenfo:array of string;<br> &nbsp;filename:array of string;<br> &nbsp;addline:array of string;<br>implementation<br><br>{$R *.dfm}<br>{*大家帮看看,为什么会在这里出错!我在&quot;tempp:=.... &quot;这里下<br>了断点,发现程序到这里之前是没有错的,再执行下去就出现<br>“http/1.1 404 not found错误提示,但是那个网页明明存在的,也不应该是重定向问题”<br>*}<br>procedure getdown;<br>var<br>begin4,end4:integer;<br>tempp,adddown:string;<br>begin<br>tempp:=form1.IdHTTP.get('http://0daycheck.eastgame.net'+trim(form1.addline[slb.ItemIndex]));<br>begin4:=pos('TLF 0Day Public FTP Server',tempp)+26;<br>end4:=pos('&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;',tempp);<br>adddown:=copy(tempp,begin4,end4-begin4);<br>form1.sm1.Lines.Add(adddown);<br>end;<br><br><br><br>procedure getcode;<br>var<br> &nbsp;i, j, begin1, begin2,begin3, end1, end2,end3: integer;<br> &nbsp;surl, ppp, entries: string;<br> &nbsp;p:dword;<br>begin<br>try<br>begin<br> &nbsp;Form1.slb.Clear;<br> &nbsp;ppp := Form1.se1.Text;<br> &nbsp;for i := 1 to length(ppp) do<br> &nbsp; &nbsp;surl := surl + '%' + inttohex(ord(ppp), 2);<br> &nbsp;ppp := Form1.IdHTTP.Get('http://0daycheck.eastgame.net/0day/search.php?tlf0dayteam%5BsearchTerm%5D=' + surl);<br> //*******************************打开搜索页面,ppp保存搜索结果的页面代码************************************<br><br> &nbsp;begin2 := pos('totalling ', ppp) + 10;<br> &nbsp;end2 := pos(' entries', ppp);<br> &nbsp;entries := copy(ppp, begin2, end2 - begin2); //获取搜索文件的总数<br><br> &nbsp;setlength(addline, strtoint(entries)); //页面动态数组<br> &nbsp;setlength(filename, strtoint(entries)); //软件名称数组<br> &nbsp;setlength(filenfo, strtoint(entries));<br><br> &nbsp;while pos('tlf0dayteam_title', ppp) &lt;&gt; 0 do<br> &nbsp;begin<br> &nbsp; &nbsp;delete(ppp, pos('tlf0dayteam_title', ppp), 4);<br> &nbsp; &nbsp;j := j + 1;<br> &nbsp;end; //计算需要循环几次<br><br><br> &nbsp;for i := 0 to j-1 &nbsp;do<br> &nbsp;begin<br> &nbsp; &nbsp;begin1 := pos('itle&quot;&gt;&lt;a href=&quot;', ppp) + 15; //获取下载开始位置<br> &nbsp; &nbsp;end1 := pos('.html&quot;&gt;', ppp); //结束下载位置<br> &nbsp; &nbsp;addline := copy(ppp, begin1, (end1 - begin1 + 5)); //得到下载页面位置<br> &nbsp; // Form1.slb.Items.Add(addline);<br><br>//****************************************获取软件页面地址,保存在数组addline中***************************<br><br> &nbsp; &nbsp;begin2 := pos(addline, ppp) + length(addline); //获取软件名称开始位置<br> &nbsp; &nbsp;end2 := pos('&lt;/a&gt;&lt;/h4&gt;', ppp); // 软件名称结束位置<br> &nbsp; &nbsp;filename := copy(ppp, begin2 + 2, (end2 - begin2-2));<br> &nbsp; &nbsp;filename:=StringReplace(filename,'&lt;br /&gt;',' &nbsp;| EN: | &nbsp;',[rfIgnoreCase]);<br> &nbsp; &nbsp;Form1.slb.Items.Add(filename);<br><br>//***************************************获取软件名称,保存在数组filename中*******************************<br> &nbsp; &nbsp;begin3:=pos('&lt;div class=&quot;tlf0dayteam_entry&quot;&gt;',ppp)+31;<br> &nbsp; &nbsp;end3:=pos('&lt;div class='+#39+'tlf0dayteam_entryFooter'+#39+'&gt;',ppp);<br> &nbsp; &nbsp;filenfo:=copy(ppp,begin3,end3-begin3);<br> &nbsp; &nbsp;//form1.slb.Items.Add(filenfo);<br>//****************************************软件信息,保存在数组<br> &nbsp; &nbsp;end2:= pos('&lt;/a&gt;&lt;/h4&gt;', ppp);<br> &nbsp; &nbsp;delete(ppp, end2, 7);<br> &nbsp; &nbsp;delete(ppp, begin1 - 15, 15);<br> &nbsp; &nbsp;end1 := pos('.html&quot;&gt;', ppp);<br> &nbsp; &nbsp;delete(ppp, end1, 7);<br> &nbsp; &nbsp;end1 := pos('.html&quot;&gt;', ppp);<br> &nbsp; &nbsp;delete(ppp, end1, 7);<br> &nbsp; &nbsp;begin3:= pos('&lt;div class=&quot;tlf0dayteam_entry&quot;&gt;',ppp)+31;<br> &nbsp; &nbsp;delete(ppp,begin3-31,31);<br> &nbsp; &nbsp;end3:=pos('&lt;div class='+#39+'tlf0dayteam_entryFooter'+#39+'&gt;',ppp);<br> &nbsp; &nbsp;delete(ppp,end3,30);<br> &nbsp; &nbsp;//Form1.sm1.Clear;<br> &nbsp; &nbsp;//Form1.sm1.Lines.Add(ppp);<br> &nbsp;end;<br> &nbsp;end;<br> &nbsp;finally<br> &nbsp;end;<br>end;<br><br><br>procedure TForm1.sb1Click(Sender: TObject);<br>var<br> &nbsp;id: dword;<br>begin<br> &nbsp;createthread(nil, 0, @getcode, nil, 0, id);<br>end;<br><br>procedure TForm1.se1KeyPress(Sender: TObject; var Key: Char);<br>begin<br> &nbsp;if Key = chr(13) then<br> &nbsp; &nbsp;Form1.sb1.Click;<br>end;<br><br>procedure TForm1.slbClick(Sender: TObject);<br>var<br>i:integer;<br>j:dword;<br>begin<br>sm1.Clear;<br>i:=slb.ItemIndex;<br>if pos('&lt;br /&gt;',filenfo)&lt;&gt;0 then<br>begin<br>filenfo:=copy(filenfo,1,pos('&lt;br /&gt;',filenfo)-1);<br>sm1.Lines.Add(filenfo);<br>end<br>else<br>sm1.Lines.Add(filenfo);<br>showmessage(addline);<br>createthread(nil, 0, @getdown, nil, 0, j);<br>end;<br><br><br>end.
 
TIdHTTP 到有域代理的机器上就通不过了啊,郁闷~~
 
是同一个网站,域名是相同的,而且在第一个线程那里还可以获取网页的源代码,但是到了第二个线程就出错了,第二个线程就是在原网址后面加上第一个线程获取的网页路径,就像<br>在http://www.delphibbs.com/后面加上delphibbs/dispq.asp?lid=3281476,但是这样就错误了???但是用ie还是可以打开的
 

Similar threads

后退
顶部