Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Howto Read HTML Source From VB6 ?


I'm trying to figure out how to have a list of URL's and use VB6 to basically grab the source code for those URL's (piping it to a text file or something).

I'm really having trouble finding any information on how to do this.

Another question would be: If I'm going through a list of URL's (sites) how can VB6 know when a web page is finished loading? It would have to wait until the page finishes loading, then grab the source code and repeat the process for the next URL in the list (and so on).

Basically, I'm trying to collect data and I need to gather the raw source of sevral web pages, so I can scan through the html text for information.

I really appreciate any help....




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do You Read Html Source?
Hi,

Can anyone please write a sample program for me telling how to read html sourcecode? I get really confused when people just give a function and nothing else cause I dont know too much.

Thanks

Resolved: Read Source Code From Html
Hi All, pls kindly help me to solve this mystery.

I got 2 html files from same site, yet the format (in source code) is not same.

for example,

sample 1:
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
.......
<META content="text/html; charset=utf-8" http-equiv=Content-Type ;>
<META content="MSHTML 5.00.3502.5390"
name=GENERATOR></HEAD>.......
<TD><B>Scheduling Agreement </B></TD>
<TD>: 61100299290007</TD></TR>
<TR>
<TD><B>Date </B></TD>
<TD>: 07-OCT-2003</TD></TR>
<TR>
<TD><B>PO </B></TD>
<TD>: 6110029929</TD></TR>
<TR>
<TD><B>Last Sched. Agreement </B></TD>
<TD>: 61100299290006</TD></TR></TBODY></TABLE><BR><B>Buyer

sample 2:
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML><HEAD><TITLE>TMMPLANT</TITLE><meta http-equiv="content-type" content="text/html"; charset="UTF-8">.........
/HEAD><BODY style="font-family: arial;font-size: 12px">........
TR><TR><TD><B>Scheduling Agreement </B></TD><TD> : 61100137750001</TD></TR>
<TR><TD><B>Date </B></TD><TD> : 07-OCT-2003</TD></TR>
<TR><TD><B>PO </B></TD><TD> : 6110013775</TD></TR></TABLE>

Date tooks 2 lines in sample 1 but only took 1 line in sample 2. Pls kindly advise why this happened and how to solve as I need to read the content into database.

Thanks

How Do I Read HTML Source From The WebBrowser Control?
This is probably a silly question, but I'm just starting out in VB so please
bear with the newbie ;)

I've set up a form that contains a Webbrowser control. Now, when I
type in a URL and click a button, that URL is loaded in the webbrowser.
Once that webpage is loaded, how can I load the page contents into
something like a dimmed array?
Something like  MyHtml(codelinenumber) ?

This is a really cool forum by the way.... glad I found it!
Thanks,
AT

Read Source Code Of Html File
How can i get source code of a HTML file using VB.
Thnx
Retesh

HOWTO: Add Appointment To Outlook Calendar, Data Source Is From Access Database
Hi,
I have a database using Access as the front-end and SQL Server as the backend.
In the database, there are these fields: Next appointment date, next appointment time, and client's name.
Base on these fields, I want to add an appointment to Outlook calendar using VBA.
I don't know if this is possible because from what I've seen so far, people is going the other way around (export Outlook data to access), not export access data to Outlook.
Can somebody help me?
Thanks.

-Steve

HowTo Extract From HTML Files
How to extract something from html or text files?
suppose that i wanna extract proxies from a HTML FILE
in the form ----> IP:PORT


i wanna code something like that to leech proxies from webpages.

thx

Howto Read Certain Cells Value In Vb6?
hi, I need to read a certain range cells value in a Excel workbook. I had searched in the forum and Internet. now i need your advice for my problem:

(1) most example are using Excel.Application with the "Microsoft Excel 10.0 Object Library" (or 8.0, 9.0 etc). my problem was there were many version of Excel in different computer, either in office 97, office 2000, office xp, or office 2003. in my own computer was office 97, how can i make my app can work in the computer using office xp?

(2) some exampl using ado, read all the data in Excel workbook, not certain range. how to use ado to only read certain range?
I also found a problem in this example, where 2 col used megre in few row, later then the other row only can be read 1 col, left col' data was missing. any solution?

Thank you.

Howto Save The Html Or Asp Page To System
Hi all,

I want to save the particulare html or asp page is
appearing the internet of my System.

For example : I Connect the website like
"WWW.Suresh.com
rr est.htm"

I want the vb code to get the corresponding web page's
content into text file .

I use the internet Control.

Please send the code. or Example

Thank you.

S.Suresh Rajkumar

BestPractise: Howto Read Out Config.txt
Hi there

I would like to know which approach you would choose to read out a config.txt

Let me say it has got entries like:

Username = "Mike"
Password = "Nancy69"

Would you read out the line-numbers or is there a way to read out the value of "Username" directly?


regards
Raggi

Vb Howto Read Sequential Files
below shows how i saved employee number & hours to a sequential file :

it works fine!
--------------------------
Private Sub CmdTsSave_Click()
Dim TSEmpNo As Integer
Dim TSHours As Integer

EmpNo = TxtTSEmpNo
hours = TxtTSHours

Open App.Path & " imesheet.txt" For Append As #2
Write #2, EmpNo, hours
Close #2
End Sub
------------------------------------
i would like to know the code to get this information back into Empno.text and hours.text
someone help please

Howto Read Text From The Webbrowser Control.
Hi,

I want to know if there's an (easy) way to read the (html)text from the webbrowsercontrol?
It doesn't have to be parsed, just the html code should be enough.

Tnx

Nick

Howto Read Data From Memory Address
Hi, Code Guru,
Is that any commands in VB6 to read data from memory address ?

when I use "MEM " in MS-Dos prompt , it show me a list of memory address which corresponde to certain drivers.

You see, I need to write VB Coding so that I can access the data
in certain memory address or accesing data in PRN .

If I able to access/ read data in this memory address. Is the data
in Hex or Ascii format ?

The reason why I need to access the memory address because right now I am working on a project to write an VB interface
to read from a DOS-Application program ( no longer have the source code ) which send the data direct to the screen and also
send to printer for printout.

If possible please help me in coding .

Thank you.
Dennis PC

Howto Read Property Of Webbrowsercontrol In Foreign Program?
Hi Forum,

I want to read out the property LocationURL of an webbrowser-control in an other application. I have the window handle of the control, can anyone tell me if this is possible and how to do it?

Thx!

Windows XP Button Howto (Read This Its Realy Cool)
Hey there,

i found a UserControl on the internet that make's Windows XP buttons in you VB Application!

Its cool though, but there is only 1 color available.

Download the Zip file, and place it somewhere on your computer. Make a new project, and add
the XP_Button usercontrol to your project.

Now, add the line below to your Form_Load section where Form1 is the form that contains the buttons:

Code:
InitialiseButtons Form1, True, True 'Must Call this to initialise the buttons


Place the code below somewhere apart in your project.

Code:
Public Sub InitialiseButtons(FrmForm As Form, Initialise As Boolean, Optional BytEnabled As Boolean)
On Local Error Resume Next
Dim Control As Object 'Define the variable control as an object
    For Each Control In FrmForm 'Check all controls on a form
        If TypeOf Control Is Command Then
            If Initialise = True Then
                Control.Initialize 'If its a XP command button then initialise it.
            Else
                If BytEnabled = True Then
                    Control.Enabled = True
                Else
                    Control.Enabled = False
                End If
            End If
        End If
    Next


Happy programming and have fun with this UserControl!

Greets,

DigitalHuman

How To Take Source Html From:
I am a italian boy, scuse my english,

I must take the source code of a web page, but this page, can be visited only before the login, then i have thinked to take the source, in the Temporaney files, there are other solution?
for example, to view the source by a page opened with a browser, or to do the login with vb, (the insertion of a normal, user and password, in a textbox of a web-page) or other?
pls help me

HTML Source
I need to get an HTML source from a web page and put it in a text box does anyone know how to do this?

Html Source
Code:
strWebReturn = Inet.OpenURL("http://www.google.com" )
Okay, this will return the sourcecode for a website, but it wont return it if the website is on your local drive or a network drive.
I have played with the code but have not been able to figure out how to get the sourcecode for an html doc if it is ...say
C:/some.html
Any ideas?

Html Source
Hi everyone..is there a way to easily get the source code(HTML) of a specified webpate...using the webbrowser control??
regards
jcd

How To Get Html Source With Api ?
how to get html source of a web page with only vb and api ? (no forms or activex controls)

Html Source
I have a web page that I need to retrieve the source code from so that I can parse the info from.
I have seen many threads here on how to parse and think that I can figure this part out, what I need to know is how to retrieve the sourcecode from a given webpage...i.e. google.com.
How would I go about reading the sourcecode that builds the page.
We have a webpage here at work that I need to parse info out on a weekly basis and then use the parsed info to create a query..
not sure where to start, what app to build, etc.
Any help would be appreciated.

HTML Source
Hi all,
Using the following code, I'm able to quickly get the source code of a webpage:


VB Code:
Dim strHTML As String    Dim objBrowser As SHDocVw.InternetExplorer    Dim objWindows As New SHDocVw.ShellWindows     txt_Source = ""     If objWindows.Count Then        For Each objBrowser In objWindows        strHTML = objBrowser.Document.documentElement.innerhtml        txt_Source = strHTML        Next objBrowser    End If     Set objWindows = Nothing    Set objBrowser = Nothing


The problem is that if the page has frames, only the source code of the first frame comes back. Any suggestions on getting ALL of the source code? Or maybe even specifying which frame to retrieve?

Any suggestions would be greatly appreciated.

Thanks in advance,
- Sam

Get HTML Source
sir....
how can i get the html source of a site using api? i dont want to use shdocvw.dll...

please help...

ram

VB + HTML Source
Hello Big Brothers

I have List ofIP Address in Excel file

I want to know its Whois Location that we can found at
http://www.dnsstuff.com/tools/whois.ch?ip=59.210.16.17

Just change IP Address at right and you can find webpage that shows its location (I can do that)

problem is that how do i read webpage source from VB

Should i use Browser control ?
If yes then whats the method to read source of loaded page ?

plz help me in that and if possible then write some line of code

Thanks in Advance

How To Get Html Source With Api ?
how to get html source of a web page with only vb and api ? (no forms or activex controls)

HTML Source
I found the following in a similar thread, and I'm very close... but the code needs a little tweaking somewhere...


VB Code:
Dim objIEs As New SHDocVw.ShellWindowsDim objIE As SHDocVw.InternetExplorerDim strHTML As String If objIEs.Count Then    For Each objIE In objIEs        If InStr(1, objIE.LocationURL, "main.jsp") Then            strHTML = objIE.Document.documentElement.outerHTML            Debug.Print strHTML        End If    Next objIEEnd If Set objIEs = NothingSet objIE = Nothing


The thing is that one of our webpages has the first couple hundred lines of code commented. This was done for debugging purposes, so all we have to do is "View source" via IE to look at the server response.

Anyways, using the above code, strHTML starts off with "<html><head><title>" etc... The entire commented block which preceeds that just isn't there.

Is there anyway I can make sure I pick up all of the source code, comments and all? Any help would be greatly appreciated.

Thanks in advance,
- Sam

HTML Source
Code:
Richtextbox1.text = Inet1.OpenURL("http://forums.vb-world.net")


Anyone know why this only returns half of the html source code?

Getting HTML Source From URL
Hi all,

I'm trying to build a downloader in Visual Basic 6.0

As the first step i'm trying to get the source of the HTML page and then to download the resource from that page.

I use Internet Transfer Control's OpenUrl method to get the html source.

I get the full html source with sites like www.microsoft.com like
source = Inet1.OpenUrl("www.microsoft.com").

But for some other sites i get only truncated or partial html source..for ex:

source =

Inet1.OpenUrl("http://archies.indiatimes.com/ecards/jsp/Card.jsp?card_id=59

3&Lvl1=01&Lvl2=01&Lvl3=01&Lvl4=00&hBr=1")

Can anyone please explain me why this is happening and how to resolve this so that i can get the full html source.

Or

Is there any other ways to get the full Html source other than using Internet transfer control?

Note:I dont want to use Execute method of Inet as it is asynchronous.

Thanks a lot for your help,
Suresh.

Get The Html Source From A URL
Hello all,

Does anyone know how to get the Html source code from a URL within a vb 6.0 application??

Getting Certain Text From HTML Source?
Ok i searched the forums for getting HTML source and im using the

Inet Control to display the source in a textbox and i dont know how to
search it for certain text say inbetween Quotes "" and which ones
to read between because there may be several thing inbetween quotes "" in the source.

So i have the HTML source in a Textbox how can i search and get sumthing from it?

Anyhelp would be appreciated.

P.S i have seen other posts that have code but it didnt seem to work for
me and i rarly use EOL or wateva InStr() etc so i dont know how to use them.

Getting The Source From A HTML Document
How would I search the source of a HTML document for a certain string?
I am using the web browser form in VB how would I get the source of the document that is displayed? I know how to get the URL and title of the document but not the HTML source

I need to get the source from a HTML document so I can search it (with if ________ like _________ then ________ ) and I don't know how.

Also, is there other ways of searching something like that other then the way above?

View HTML Source
I would like to create a button that will retrieve the source code of an HTML page typed in a textbox. I am unsure if this is even possible. The final application for this will be to retrieve the current temperature by parsing out the temp from the source code from a url from www.weather.com.

I appreciate any guidance on this.

Grab HTML Source
I asked about this earlier, but I did not really know what I was asking for. I know a little bit more about what I am asking for now. What I have is a site that generates the HTML on the fly with Java code and sends it to different windows on the current viewing page. Is there any way I can get to this window to automatically put in the data that is needed? For example I sign into a logon page that then sends me to a a website that the link never changes and every link I look at after that is prefaced with the words javascript: This is okay for the links to get me to a report, that also has gotoAction() after it, but for the submit button is is listed as javascript: PCX12345678984362121456214_submit(): I can see the source when I click on that portion of the webpage, all I really need is to get to that window so I can manipulate it. Any help would be greatly appreciated, I have been stuck on this for a week now.

Encrypt Html Source
Can anybody look at this code and tell me what is wrong with it.




Code:
Option Explicit

'Encrypt HTML code that user has selected

Private Function EncryptIt(keyword As String, lLEn As Long) As String

Dim i As Long
Dim NewSlovo As Long
Dim K
i = 1

Do Until i = lLEn + 1
NewSlovo = Asc(Mid(keyword, i, 1)) + 3
EncryptIt = EncryptIt + Chr(NewSlovo)
i = i + 1

Loop
End Function


'Insert the code in the frontpage

Public Function AddHTMLToPage(objPage As FPHTMLDocument, _
strHTMLtext As String, blnClearPage As Boolean) As Boolean

Dim objRange As IHTMLTxtRange
Dim objBody As FPHTMLBody

On Error GoTo ErrorHandler

If blnClearPage Then
Set objRange = objPage.All.tags("BODY").Item(0).createTextRange

' clear out the current document

If blnClearPage Then
Call objRange.pasteHTML("")
End If
objRange.collapse False
Set objRange = Nothing
End If

Set objBody = objPage.body
objBody.innerHTML = objBody.innerHTML & strHTMLtext & vbCrLf

AddHTMLToPage = True

ExitFunction:
Exit Function

ErrorHandler:
'Could not insert HTML.
AddHTMLToPage = False
GoTo ExitFunction

End Function

Private Sub Start_Click()

Dim sEncryptIted As String


Dim T001
Dim T002
Dim T003
Dim T004

'Text boxes which have java script


T001 = prvalinija.Text
'prvalinija = <script>function u( s )
'{ var sRet=""; for(i=0; i< s.length; i++ )
'{ var n= s.charCodeAt(i);sRet += String.fromCharCode( n -3 );
'} return( sRet ); }

T002 = drugalinija.Text
'drugalinija = md = "

T003 = trecalinija.Text
'trecalinija = "

T004 = cetvrtalinija.Text
'cetvrtalinija = ; var s= u(md);document.write (s);</script>

With ActiveDocument

Dim keyword As String
keyword = Trim(.Selection.createRange.Text)
sEncryptIted = EncryptIt(keyword, Len(keyword))
Dim strHTMLString As String
Dim objBold As IHTMLElementCollection


'Put the all together
strHTMLString = T001 & T002 & keyword & T003 & T004


If AddHTMLToPage(ActiveDocument, strHTMLString, True) Then
'Does nothing, will throw a message box
' MsgBox Application.UserName

End If


End With

End Sub

Getting HTML Source From Website
Ok I am working on about 5 different programs at the moment and it seems i have hit abump in my dictionary program i wanted it to search at dictionary.com for a word and then get the html source and parc it out seriously very very easy to parc out but i cant get my textbox to get the source code any helpers out there that know that code thanx ....

HTML Source Code
Hi Guys, here is a challenge for you's.

How do you get the html code of a web site? and how do you get google's source code?

I having started coding yet, but if any on code tell me how to get this code it would be appreciated!

Many thanks
Mathy

Getting HTML Source Code
VB Code:
Form1.txtHTML = Form1.WebBrowser1.document.body.innerHTML


currently i have a web browser in which i need to get the souce code for the page i am viewing, previously i was using the above code with the ie control, but i have swapped this control for the firefox activex control due to other issues. This now causes an error of

"Automation Error
Library not registered"

i have to get the code from this browser window as using a different control takes me to the home page of the site (need to be logged in to view this page)

Get Part Of HTML Source
It is possible to retrieve HTML Source with Inet (Internet Transfer Control) and Winsock in VB. It seems to take up a huge chunk of time and freezes the application.

Is it possible to only get a bit?

Not, receive then cut a chunk off - but recieve only a half.

All answers are appreciated.

Grab Html Source
My program grabs the html source, and I'm not sure how to seperate it enough just to get a certain part.. here is a section of the HTML..


HTML Code:

<tr>
<td align=right>
<font face=arial size="-1">AS&nbsp;DA:</font></td>
<td><font face=arial size="-1"><b>John</b></font>
</td>
</tr>


In the source of the entire page, there are many things like
HTML Code:

<font face=arial size="-1">

I want to know how to find the John part somehow using the
HTML Code:
AS&nbsp;DA
part to get it. Thanks for any help.

How To Get HTML Source From Web Control?
I have a web control in my application. I use it to login gmail. The web control shows the emails I have. How can I get the HTML source of the page the web control is showing?

thanks

Get HTML Source (RESOLVED)
Could Someone please post how to download HTML source to a text box? Sample could would be great!

Encrypth Html Source
Can anybody correct this code. I dont know whats wront with it.
Trying to encrypt HTML code.


Thank u all 4 helping


VB Code:
Option Explicit 'Encrypt HTML code that user has selected Private Function EncryptIt(keyword As String, lLEn As Long) As String     Dim i As Long    Dim NewSlovo As Long    Dim K    i = 1     Do Until i = lLEn + 1        NewSlovo = Asc(Mid(keyword, i, 1)) + 3        EncryptIt = EncryptIt + Chr(NewSlovo)        i = i + 1           LoopEnd Function  'Insert the code in the frontpage Public Function AddHTMLToPage(objPage As FPHTMLDocument, _        strHTMLtext As String, blnClearPage As Boolean) As Boolean     Dim objRange As IHTMLTxtRange    Dim objBody As FPHTMLBody        On Error GoTo ErrorHandler     If blnClearPage Then        Set objRange = objPage.All.tags("BODY").Item(0).createTextRange                ' clear out the current document                If blnClearPage Then            Call objRange.pasteHTML("")        End If        objRange.collapse False        Set objRange = Nothing    End If     Set objBody = objPage.body    objBody.innerHTML = objBody.innerHTML & strHTMLtext & vbCrLf     AddHTMLToPage = True   ExitFunction:    Exit Function   ErrorHandler:    'Could not insert HTML.    AddHTMLToPage = False    GoTo ExitFunction End Function Private Sub Start_Click()     Dim sEncryptIted As String          Dim T001    Dim T002    Dim T003    Dim T004            'Text boxes which have java script                T001 = prvalinija.Text    'prvalinija =   <script>function u( s ) { var sRet=""; for(i=0; i< s.length; i++ ){ var n= s.charCodeAt(i);sRet += String.fromCharCode( n -3 ); } return( sRet ); }        T002 = drugalinija.Text    'drugalinija =   md = "        T003 = trecalinija.Text    'trecalinija =   "        T004 = cetvrtalinija.Text    'cetvrtalinija = ; var s= u(md);document.write (s);</script>        With ActiveDocument      Dim keyword As String    keyword = Trim(.Selection.createRange.Text)    sEncryptIted = EncryptIt(keyword, Len(keyword))    Dim strHTMLString As String    Dim objBold As IHTMLElementCollection            'Put the all together    strHTMLString = T001 & T002 & keyword & T003 & T004      If AddHTMLToPage(ActiveDocument, strHTMLString, True) Then      'Does nothing, will throw a message box      '  MsgBox Application.UserName           End If  End With End Sub

Download HTML Source
I would like to use winsock to connect to a URL and download the html Source Code, I have tried using winsock but I keep getting error 8 ... I do not think I am sending the right DATA to the server;

Any help would be appreciated

Inet: Get HTML Source
I'm using this code to get the HTML source of a webpage:


VB Code:
Private Sub cmdGet_Click()Dim strSource As String, iLoc As IntegerDim strLinks() As String, i As Integer    Me.MousePointer = 11    With Inet1    strSource = .OpenURL("http://www.leftofreality.net/", icString)  End With    strSource = Replace(strSource, vbLf, vbCrLf)  strSource = Replace(strSource, vbCr, vbCrLf)      txtSource.Text = strSource      strLinks() = ParseSource(strSource)      For i = 0 To UBound(strLinks)    txtLinks.AddItem strLinks(i)  Next    Me.MousePointer = 0End Sub


However, it doesn't seem to get everything. Any ideas?

Getting Html Source Code
how can i get the souce code of an html document without using the microsoft file transfer control

Getting HTML Source Code
What's the easiest way to get the source code from a website (ex: the source code from www.abc.com/whatever.html). Thanks in advance! Later,

-zer0 flaw

Getting Source Code Out Of A HTML Doc
Anyone know how to do this. I want to open various webpage source code and put that html code in a richtextbox. Thanks for the help!

How Do I Retrieve HTML-source....
when im using the WebBrowser component??


Regardz
Janus

Getting Html Source Code ?
hi!
im trying to get the html source code of a webpage in a string variable. I tried to use the iNet control which worked *almost* fine with one url, but with another url it says "type mismatch" on this line:
strWebPage = iNet.OpenUrl(<url>)
where <url> = "http://webfin.infinit.com/cgi-bin/naq.cgi?cmd=getCotes&symlist=dlsc&country=usa"
any ideas on this one or alternatives?
thanks

How Do I Catch A Html-source?
Hello!

How do i retrieve a webpage-sourcecode from with a classmodule without using a hidden form?

I think it's difficult to place a component in a class - can it be done some other weay??


Kind regards
Janus

Copyright © 2005-08 www.BigResource.com, All rights reserved