vb control to request a URL. Winsock or another lightweight method to carry http request

I would like to know if anyone has a suggestion for a very simple VB app to simply request a web page.  The request in it of itself triggers the more useful features.  I've tried using the Microsoft Winsock control but this one works with other controls of its kind.  I tried using this control for connecting to a server and requesting the page but this did not work.  The Internet Transfer Control seems to be a bit too big for such a simple request.  
Any suggestions.
LVL 2
bisonfur37Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
Is the WebBrowser control too big for your liking?
0
bisonfur37Author Commented:
I believe the WebBrowser control is only a megabyte.  Is this the smallest control for simple http requests?  Would anything smaller turn this solution into something complex/cumbersome.  Thank you for your response.
0
fantasy1001Commented:
Try this
Private Sub Command1_Click()
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
  IE.Navigate "http://www.google.com"
  IE.Visible = True
 
  While IE.Busy
      DoEvents
  Wend
End Sub

Thanks
Fantasy
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

AbuMariamCommented:
If I understand your request, try this:

Call Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE www.google.com", vbMaximizedFocus)

0
Dang123Commented:
A great site to look at for this would be

http://www.vbip.com/

To start off, here is a set of tutorials on the site that use winsock to download web pages

HTTP with MS Winsock Control - Part I - How to download a file from the Web
http://www.vbip.com/winsock/winsock_http_01.asp

HTTP with MS Winsock Control - Part II - How to track the progress of data transfer
http://www.vbip.com/winsock/winsock_http_02_01.asp

The set goes to 7 tutorials, but these look like they should answer you question (you can find all of them listed on the main page)
0
Yrag1Commented:
Copy and paste this into a standard vb exe
it uses the windows api's to connect to a website and receives all the data for a specified page.
the combo box will store url's for you


Const scUserAgent = "Test prog" 'this is logged as the agent name on the webserver
Const myURL = "http://www.kenhall.org.uk" 'my website
Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 3
Const INTERNET_FLAG_RELOAD = &H80000000
Private Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet As Long) As Integer
Private Declare Function InternetReadFile Lib "wininet" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetOpenUrl Lib "wininet" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal lpszUrl As String, ByVal lpszHeaders As String, ByVal dwHeadersLength As Long, ByVal dwFlags As Long, ByVal dwContext As Long) As Long

Public Sub getHTML()
    sURL = Combo1.Text
    Dim hOpen As Long, hFile As Long, sBuffer As String, Ret As Long
    'Create a buffer for the file we're going to download
    sBuffer = Space(2000000)
    'Create an internet connection
    hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
    'Open the url
    hFile = InternetOpenUrl(hOpen, sURL, vbNullString, ByVal 0&, INTERNET_FLAG_RELOAD, ByVal 0&)
    'Read the first 1000 bytes of the file
    InternetReadFile hFile, sBuffer, 1000, Ret
    'MsgBox Ret
    'clean up
    InternetCloseHandle hFile
    InternetCloseHandle hOpen
    'Show our file
    If InStr(1, sBuffer, "<html>") = 0 Then
        RichTextBox1.Text = "Your URL was incorrect"
    Else
        RichTextBox1.Text = sBuffer
    End If
End Sub

Private Sub Command1_Click()

       Combo1.AddItem (Combo1.Text)
       getHTML
End Sub

Private Sub Form_Load()
    Combo1.AddItem (myURL)
    Command1.Caption = "Get Page"
End Sub


Hope this works for you
Gary
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fantasy1001Commented:
Just for your information:

Create a new form with a textbox (multiline set to true), a command button. Add a component named Microsoft HTML Object Library

sub Command1_OnClick
    Dim objMSHTML As New HTMLDocument
    Dim objDoc As HTMLDocument
    Set objDoc = objMSHTML.createDocumentFromUrl("http://www.intel.com", vbNullString)
   
    While objDoc.readyState <> "complete"
        DoEvents
    Wend
    Text1.Text = objDoc.documentElement.innerHTML   'set to innertext if you want only text
end sub

~ fantasy ~
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

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.