|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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?? |
|
#2
|
|||
|
|||
|
One way is to use the webbrowser control. Another is to use the MS Inet Control
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
Cheers Doug,
I got it working. I tried using the browser control but I could not get the source code from that. I could only display the html page. If anyone else is interested. Add as a component the Microsoft Internet Transfer Control. This should add an extra icon to your toolbar. Add this icon to your form and give it a name (inet1). Then it is as simple as : inet1.OpenURL This returns the source code as text. |
|
#4
|
|||
|
|||
|
FYI, you have access to the entire page Document DOM object in the webbrowser control, so you can get the page source. I havent't reviewed any code, but off the top I think you use
wbcontrol.document.<whatever> just as you would in js. |
|
#5
|
|||
|
|||
|
Msxml2.ServerXMLHTTP
Quick example:
Dim oxmlhttp As New Msxml2.ServerXMLHTTP 'oxmlhttp.setTimeouts(resolveTimeout, connectTimeout, sendTimeout, receiveTimeout) oxmlhttp.setTimeouts 50000, 50000, 600000, 600000 'oxmlhttp.Open "GET", "https://www.anysite.com?cmd=LIST", False oxmlhttp.Open "GET", strURLnVars, False ' True is asynch, False is synch ' Use proxy if provided (some implementations dont support SetProxy) If strGBSProxy<>"" Then oxmlhttp.setProxy 2, strGBSProxy 'Error: -2147012858 The code below solves the ocurrence of this error ' Description: The host name in the certificate is invalid or does not match Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056 oxmlhttp.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS ' Send the request oxmlhttp.Send 'While oxmlhttp.readyState <> 4 ' oxmlhttp.waitForResponse 1000 'Wend The source of the page can be read from " oxmlhttp.responseText " The status of the page from " oxmlhttp.Status " (200, 500, 404 and such) |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Get the html source from a URL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|