I have to write a Delphi 5 program to send to a HTTP site 1 line of text to send SMS to selected numbers using WebBrowser1

The Webbrowser1 shows messages 0 Successfull 10 error etc
How can I read the WebBrowser text to get the error number so I can display it in a form the user can understand
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel PASQUIERFreelance Project ManagerCommented:
you have to analyse the HTML, find the tags that are delimiting your error code and other useful info

it all start by getting the Document interface of your loaded page , then using it to walk through the elements to identify key tags, and the text that might be after or inside a open/close tag pair
Here is MSDN reference for that :

Note that there are many Document interfaces, that have been added with different versions of IE, among which the 2 & 3 are the most usefull.
You will also have to be familiar with the IHTMLElementCollection interface, as many Document crawling involve getting collection of elements, either by asking all that correspond to a certain tag, or get all childs of one element etc...

Here are a few examples to get you started

   Document2 : IHTMLDocument2;
   Document3 : IHTMLDocument3;
   Collection: IHTMLElementCollection;
   Element   : IHTMLElement;
 Document2:=Webbrowser.Document As IHTMLDocument2;
 Document3:=Webbrowser.DocumentAs IHTMLDocument3;
 Collection:=Document2.All; // All elements in your HTML, including header !
 Collection:=Document2.Body; // All elements of the body, usually a good start
 Collection:=Document3.getElementsByTagName('a'); // a good way of getting all links
 Collection:=Document3.getElementsByTagName('tr'); // get all table rows
 for i:=0 to Collection.Length-1 do 
   Element:=Collection.Item(i,'') as IHTMLElement;
   if Element.TagName='td' Then 

Open in new window

To receive response text from HTTP server and put it in TMemo, use the following even of TWebBrowser

procedure TForm1.WebBrowser1DocumentComplete(ASender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
Memo1.Text := WebBrowser1.OleObject.Document.documentElement.innerText;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KevinfeeningAuthor Commented:
Worked Perfectly thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.