how do i do this?

i'm trying to get a piece of information froma webpage, the page looks something like this but larger.

// -->
<SCRIPT LANGUAGE="JavaScript1.2" SRC="" ></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="" ></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="" ></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="" ></SCRIPT><SCRIPT LANGUAGE="JavaScript1.2">

TD class="blkVerdanaText10">
// <!--#if expr="" -->
var remoteAddr
// <!--#endif -->

i want to get a part of this text let say it was: blkVerdanaText10

how would i find it and extract the text between TD class=" and ">
Who is Participating?
SNilssonConnect With a Mentor Commented:

Here you are, this function will return the page source as a string.
You can then use functions as Substring to parse the text.

  Public Function GrabHtmlSource(ByVal sUrl As String) As String

        Dim req As System.Net.WebRequest
        Dim oResult As System.Net.WebResponse
        Dim oReceiveStream As System.IO.Stream
        Dim oEncode As System.Text.Encoding
        Dim bRead() As Byte
        Dim iBytes As Integer
        Dim sSource As String

            oEncode = System.Text.Encoding.GetEncoding(1252)
            req = System.Net.WebRequest.Create(sUrl)
            oResult = req.GetResponse()
            oReceiveStream = oResult.GetResponseStream()
            bRead = New Byte(512) {}
            iBytes = oReceiveStream.Read(bRead, 0, 512)

            While (iBytes > 0)
                sSource = sSource & oEncode.GetString(bRead, 0, iBytes)
                iBytes = oReceiveStream.Read(bRead, 0, 512)
            End While
            Return sSource
        Catch Ex As Exception
            Return ""
            oReceiveStream = Nothing
        End Try
    End Function
use LWP::Simple;
print "$1\n" if get("") =~ /TD class="(.*?)">/;

What language? What platform? How are you getting the html?
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Copy the code below and save it as html file, then run the file from your browser.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TD class="blkVerdanaText10">data</TD>
<script language="javascript">

I wrote the code so that you can see how you can read both the content of the table cell and the attribute of the TD tag:
1. yourdata is the variable in which I read the content of the table cell
2. yourclass is the variable that reads the class attribute of the TD tag
3. both variables are written on screen by the document.write statements

You are interested in fact by the getAttribute method applied to the object.
Adapt the code to your program.

andyakiraAuthor Commented:
im working in VB, sorry for the late reponse.  i thought i postedin the vb section.
The "getElementsByTagName" and "getAttribute" can be used in too. I'm not going to write another code now in VB, but...

I understand that you want to have some code written in VB.NET for getting information from a webpage, therefore I'm giving you this link:

Scroll to the middle of the page and you will find the VB code. At the bottom of the page you also have a download option. Things are very good explained there. I don't think you'll need further help.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.