473,513 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading Content Of Web Pages Using Vb

6 New Member
HI,
All

I need a code some thing that can read content of webpages using vb tht is without tags.

Or else a code that can remove all the tags from viewsource after gettin the viewsource in txet file or variable


please let me know is it possible.

Mail if can to (<Removed by Moderator>)

Thanks In Advance.
Apr 24 '07 #1
7 2721
ansumansahu
149 New Member
HI,
All

I need a code some thing that can read content of webpages using vb tht is without tags.

Or else a code that can remove all the tags from viewsource after gettin the viewsource in txet file or variable


please let me know is it possible.

Mail if can to (...)

Thanks In Advance.
You can use VB 6.0 Inet Control to read the contents of the webpage and then do operations on them Just do a google search on "vb 6.0 Inet Control" and you will info for this.

-ansuman sahu
Apr 24 '07 #2
Nilya
6 New Member
You can use VB 6.0 Inet Control to read the contents of the webpage and then do operations on them Just do a google search on "vb 6.0 Inet Control" and you will info for this.

-ansuman sahu

i am using the same but the problem is that it returns the source code from which i found difficulty in retrieving the main contents


eg:

<td width="99%" class="Small"> Also include <span class="SmallBold"> Resume Summary </span></td>

i want "Resume summary"
this is just example.

Thanks for reply
Apr 24 '07 #3
Robbie
180 New Member
i am using the same but the problem is that it returns the source code from which i found difficulty in retrieving the main contents


eg:

<td width="99%" class="Small"> Also include <span class="SmallBold"> Resume Summary </span></td>

i want "Resume summary"
this is just example.

Thanks for reply
If you simply want to remove all text between '<' and '>', I'll make a function for that, it shouldn't be very hard. ;)
After making function: Okay, it was a little harder than I expected. ~_~;

Expand|Select|Wrap|Line Numbers
  1. Public Function StripHTMLTags(OriginalHTMLCode As String, Optional TagReplaceText As String = "") As String
  2. '
  3. 'OriginalHTMLCode - HTML code to strip tags from
  4. 'TagReplaceText - What this function will put in place of the
  5. 'tag (by default, nothing - an empty string)
  6. '
  7. 'Gives back the HTML code with tags replaced by TagReplaceText
  8. '
  9.     Dim StartTagPos As Long
  10.     Dim EndTagPos As Long
  11.     Dim TempTagPos As Long
  12.  
  13.     Dim StartTagNum As Long
  14.     Dim EndTagNum As Long
  15.  
  16.     Dim TempChar As String
  17.  
  18.     StartTagPos = InStr(1, OriginalHTMLCode, "<")
  19.  
  20. While StartTagPos > 0
  21.  
  22.  
  23.     If StartTagPos > 0 Then
  24.     'An open tag has been found
  25.         StartTagNum = 1
  26.         EndTagNum = 0
  27.  
  28.         'Keep searching until same number of open tags and close tags
  29.         'have been found (i.e. until nested tags finish >_<)
  30.         TempTagPos = StartTagPos + 1
  31.  
  32.         While (EndTagNum < StartTagNum And TempTagPos <= Len(OriginalHTMLCode))
  33.  
  34.             TempChar = Mid(OriginalHTMLCode, TempTagPos, 1)
  35.             If TempChar = "<" Then StartTagNum = StartTagNum + 1
  36.             If TempChar = ">" Then EndTagNum = EndTagNum + 1
  37.  
  38.             TempTagPos = TempTagPos + 1
  39.         Wend
  40.  
  41.  
  42.     End If
  43.  
  44.     EndTagPos = TempTagPos - 1
  45.  
  46.  
  47.     StripHTMLTags = TagReplaceText + StripHTMLTags
  48.     If StartTagPos > 1 Then
  49.         StripHTMLTags = Mid(OriginalHTMLCode, 1, StartTagPos - 1)
  50.     End If
  51.         StripHTMLTags = StripHTMLTags + Mid(OriginalHTMLCode, EndTagPos + 1, Len(OriginalHTMLCode) - 2)
  52.  
  53.         OriginalHTMLCode = StripHTMLTags
  54.  
  55.  
  56.     StartTagPos = InStr(1, OriginalHTMLCode, "<")
  57.     If StartTagPos > 0 Then
  58.         EndTagPos = InStr(StartTagPos, OriginalHTMLCode, "<")
  59.     End If
  60.  
  61. Wend
  62.  
  63.  
  64. End Function
  65.  
Here's an example of how to use it and what it does.
Text1.Text is:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <b>Hi!!</b>
  3. Here's <i>more</i>.
  4. </html>
  5. Yep.
  6.  
Execute this:
Text2.Text = StripHTMLTags(Text1.Text)

Text2.Text is now:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Hi!! 
  3. Here's more.
  4.  
  5. Yep.
  6.  
Hope it's what you needed. :)
Apr 25 '07 #4
Killer42
8,435 Recognized Expert Expert
...
Mail if can to (<Removed by Moderator>)
Hi.

Just a note to let you know I've removed your e-mail address from the post. See the posting guidelines.
Apr 25 '07 #5
Robbie
180 New Member
Hi.

Just a note to let you know I've removed your e-mail address from the post. See the posting guidelines.
Err, Killer, it's still in the second post by ansumansahu. ;)
Apr 25 '07 #6
Killer42
8,435 Recognized Expert Expert
Err, Killer, it's still in the second post by ansumansahu.
No it isn't. :p
Apr 25 '07 #7
Nilya
6 New Member
If you simply want to remove all text between '<' and '>', I'll make a function for that, it shouldn't be very hard. ;)
After making function: Okay, it was a little harder than I expected. ~_~;

Expand|Select|Wrap|Line Numbers
  1. Public Function StripHTMLTags(OriginalHTMLCode As String, Optional TagReplaceText As String = "") As String
  2. '
  3. 'OriginalHTMLCode - HTML code to strip tags from
  4. 'TagReplaceText - What this function will put in place of the
  5. 'tag (by default, nothing - an empty string)
  6. '
  7. 'Gives back the HTML code with tags replaced by TagReplaceText
  8. '
  9.     Dim StartTagPos As Long
  10.     Dim EndTagPos As Long
  11.     Dim TempTagPos As Long
  12.  
  13.     Dim StartTagNum As Long
  14.     Dim EndTagNum As Long
  15.  
  16.     Dim TempChar As String
  17.  
  18.     StartTagPos = InStr(1, OriginalHTMLCode, "<")
  19.  
  20. While StartTagPos > 0
  21.  
  22.  
  23.     If StartTagPos > 0 Then
  24.     'An open tag has been found
  25.         StartTagNum = 1
  26.         EndTagNum = 0
  27.  
  28.         'Keep searching until same number of open tags and close tags
  29.         'have been found (i.e. until nested tags finish >_<)
  30.         TempTagPos = StartTagPos + 1
  31.  
  32.         While (EndTagNum < StartTagNum And TempTagPos <= Len(OriginalHTMLCode))
  33.  
  34.             TempChar = Mid(OriginalHTMLCode, TempTagPos, 1)
  35.             If TempChar = "<" Then StartTagNum = StartTagNum + 1
  36.             If TempChar = ">" Then EndTagNum = EndTagNum + 1
  37.  
  38.             TempTagPos = TempTagPos + 1
  39.         Wend
  40.  
  41.  
  42.     End If
  43.  
  44.     EndTagPos = TempTagPos - 1
  45.  
  46.  
  47.     StripHTMLTags = TagReplaceText + StripHTMLTags
  48.     If StartTagPos > 1 Then
  49.         StripHTMLTags = Mid(OriginalHTMLCode, 1, StartTagPos - 1)
  50.     End If
  51.         StripHTMLTags = StripHTMLTags + Mid(OriginalHTMLCode, EndTagPos + 1, Len(OriginalHTMLCode) - 2)
  52.  
  53.         OriginalHTMLCode = StripHTMLTags
  54.  
  55.  
  56.     StartTagPos = InStr(1, OriginalHTMLCode, "<")
  57.     If StartTagPos > 0 Then
  58.         EndTagPos = InStr(StartTagPos, OriginalHTMLCode, "<")
  59.     End If
  60.  
  61. Wend
  62.  
  63.  
  64. End Function
  65.  
Here's an example of how to use it and what it does.
Text1.Text is:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <b>Hi!!</b>
  3. Here's <i>more</i>.
  4. </html>
  5. Yep.
  6.  
Execute this:
Text2.Text = StripHTMLTags(Text1.Text)

Text2.Text is now:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Hi!! 
  3. Here's more.
  4.  
  5. Yep.
  6.  
Hope it's what you needed. :)




ok i have solved the problem of removing tags, i have done it getting the source in text file and then removing the the tags.
But what i need is wanna store the source code in a variable as string using inet or web browser, as its possible in it but i think tht variable has some limit of characters.


So any other way to store the source code in variable
Thanks,
Nilesh Patil
Apr 26 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

12
3174
by: jonathan.beckett | last post by:
Hi All, For the past few months I have been working on an open source Apache/PHP/MySQL content management system - and have recently made it available for download. It's still very much a work in progress (current release version is 0.4.6), but you should get a very good idea of what it's about by visiting the site (which uses it,...
4
1518
by: Luca | last post by:
Hello Everybody, I'm a 26 years old Italian "Florentine" Computer technician :) I'm writing you about an idea that I've got of a function that could be introduced in new web browsers (or even in other computer applications). I think nobody already had this idea but I'm not sure because I didn't look deep for it. I don't ask any...
4
1915
by: pcunix | last post by:
I'm looking for general advice, pointers to web pages, books, whatever. I have a moderately successful web site. The major complaint that I get, time after time, is "It's UUUGLY" As I have explained at http://aplawrence.com/Blog/B1228.html , I understand that, and to some extent it's deliberate: I am NOT looking for flash over content...
1
3107
by: enrique | last post by:
Our server-side software is reading in Big5-encoded data as ASCII when the web pages are generated. It seems to work most of the time, since the HTML meta tag is declaring Big5 as the charset. However, every now and then certain ASCII characters, like the quote (") for example, gets read in and creates Javascript errors when the browser...
5
1308
by: darrel | last post by:
I have bits of content on a site that's running of a basic CMS system I've built. The main content on each page is pulled in from the DB, so there's at least one call to the DB on each page load. But then there's content like the page footer, which is rarely updated, and is the same on every page. Since this is rarely updated, but...
2
3108
by: kinh | last post by:
In my current PHP project, I have to read pages from a website and parse the data. If using the Internet browser, I would have to do the following steps: Step 1: specify the state to display by using: www.foo.com/selectState.asp?state=ca and it will redirect to www.foo.com/list.asp?city=sanjose&page=1 Step 2....
9
1393
by: brett | last post by:
I have a main aspx file for my site and use web controls as includes for content. The url may look like this: www.abc.com/main.aspx?page1 I'd like to store content in a text file and depending on the url query string, I'll know which text file to server up into main.aspx. How is this done? Also, I'm sure there is a better way to do...
7
2760
by: Electric Co. | last post by:
Hello, note: This is for a Faculty web site that is undergoing a migration to an open source solution so my motives are legit. I need to build a relay from IIS handling URL_A to a PHP server (URL_B), get the content from the PHP server (if it exists) and then serve it out via IIS. If the content does not exist then I need to pass the...
9
2921
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the...
4
27202
by: rrayfield | last post by:
I have a XML file that contains content for an asp.net website. I need the quickest way to find the node and write the elements out to the page. Also how would I get the links section out of it? do I have to loop through them? Example = I need the content for the Home Page, and I have the id=Home in the xml, how do I get the rest of the data...
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.