Board index » delphi » Best way to call an ASP page and reading the results

Best way to call an ASP page and reading the results

Hi,

What would be the best way, via Delphi, to make an http call to an ASP page
that returns text? What would be the best way to be able to read this text
in order to parse it?

I am currently trying to use the TWebBrowser component, but battling to get
the text of the resulting page that is displayed.

Alternatively: Any documentation on the TWebBrowser.Document object???

Using D5.

Thanks in advance.
Eugene

 

Re:Best way to call an ASP page and reading the results


You could use an idHTTP Get and load it into a TMemo, then parse it, eg:
Memo1.Lines.Text := IdHTTP1.Get(URL);

Jerry

Quote
"Eugene J" <euge...@micro{*word*143}.com> wrote in message

news:3c8e1ace_2@dnews...
| Hi,
|
| What would be the best way, via Delphi, to make an http call to an ASP
page
| that returns text? What would be the best way to be able to read this text
| in order to parse it?
|
| I am currently trying to use the TWebBrowser component, but battling to
get
| the text of the resulting page that is displayed.
|
| Alternatively: Any documentation on the TWebBrowser.Document object???
|
| Using D5.
|
| Thanks in advance.
| Eugene
|
|

Re:Best way to call an ASP page and reading the results


Quote
> Alternatively: Any documentation on the TWebBrowser.Document object???

You need to look on msdn.microsoft.com, and search for the IWebBrowser2
interface. This is what is "wrapped" by the TWebBrowser control. You'll find
info on the document object there as well.

HTH

brian

Re:Best way to call an ASP page and reading the results


Quote
"Eugene J" <euge...@micro{*word*143}.com> wrote in message

news:3c8e1ace_2@dnews...
Quote
> Hi,

> What would be the best way, via Delphi, to make an http call to an ASP
page
> that returns text? What would be the best way to be able to read this text
> in order to parse it?

> I am currently trying to use the TWebBrowser component, but battling to
get
> the text of the resulting page that is displayed.

> Alternatively: Any documentation on the TWebBrowser.Document object???

> Using D5.

> Thanks in advance.
> Eugene

Here's the code I use for this, if frames are used its more complex.
use doc.frames.items[ ] to access individual frames.
My thanks to Dave Bolton and his websearch project for the original source.

procedure TgetSVform.WB1DocumentComplete(Sender: TObject; pDisp: IDispatch;
  var URL: OleVariant);{pDisp is a const for delphi 5+}
var doc,textRange,searchFrame,nullVar:oleVariant;
    htmlText,url_str:string;
begin
     if VarIsEmpty(WB1.document) then exit;
     doc:=WB1.document;
      searchFrame:=doc.script.top;
     textRange:=searchFrame.document.body.createTextRange;
     htmlText:=textRange.htmlText;

Mike Dodson

Other Threads