How to get html tags

How to get html tags

Page 1 of 1

1 Replies - 2488 Views - Last Post: 07 July 2010 - 10:16 AM Rate Topic: -----

#1 Clarkhp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 05-June 10

How to get html tags

Posted 06 July 2010 - 09:55 AM

I'm trying to get html tags using inet exucute.But I don't how to.What should I do?.
Is This A Good Question/Topic? 0
  • +

Replies To: How to get html tags

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4307
  • View blog
  • Posts: 12,085
  • Joined: 18-April 07

Re: How to get html tags

Posted 07 July 2010 - 10:16 AM

Well first of all you have to tell the control what URL or file to fetch from. You do that with the execute method and give it a parameter such as "GET".

Inet1.Execute "http://www.google.com", "GET"



Now this is going to cause the Inet1 control's state to change. This triggers the event "StateChanged" in which you can then determine what happened. If there was an error, you can check the state parameter (passed into the event) against the constant icError. If no error happened, then you need to fetch out the data using the GetChunk method.

Like a stream the GetChunk will read in the data and place it into a variable. When it is done reading it is not going to return anything (aka the length of the returned data is zero). So you can use that information to build a loop to continue reading all the data. Concatenate the data into a string variable.

' Read in some data from our control as a String
someData = Inet1.GetChunk(1024, icString)

If len(someData) > 0 then
   ' Concatenate it onto string
   fullData = fullData & someData
Else
   ' No data was read so end reading.
End if



I purposely left out the loop here because I am not going to do everything for you. However, with the example above you can easily see how to setup a loop to read all the data into fullData and from there, you have a string you can pick out HTML tags from.

If you are looking for specific HTML tags, I suggest you try a regular expression. If you are looking for one specific tag, you can try the function InStr().

Enjoy! :)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1