?
Solved

How to download text file by passing variables?

Posted on 2003-03-05
3
Medium Priority
?
136 Views
Last Modified: 2010-05-01
I'm not sure of the termenology, but this is what I'd like to do...

If I type
"https://myaccount.somesite.com/stats.txt?login=<username>&passwd=<password>"

into my browser, the username and password I supply is sent to the server and then the appropriate text file is displayed in the browser.

I'd like to download this file using VB. I have tried using the Inet control, but it doesn't seem to send the variables correctly. All i get is a text file that contains text similar to "bad login or password" - which seems to indicate that the username and password is not being "passed" to the server.

If anyone knows of a method I could use I'd be very grateful.

Many thanks.
0
Comment
Question by:cmjacques
3 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 720 total points
ID: 8071158
Private Sub Form_Load()
GetHTMLCode ("https://myaccount.somesite.com/stats.txt?login=<username>&passwd=<password>")
End Sub

Public Function GetHTMLCode(URL As String)
  Dim IE
  Set IE = CreateObject("InternetExplorer.Application")
      IE.Navigate URL
      While IE.Busy
          DoEvents
      Wend
         GetHTMLCode = IE.Document.documentelement.innerHTML
  MsgBox GetHTMLCode
End Function
0
 
LVL 11

Expert Comment

by:supunr
ID: 8071567
you could embed the username and the password in the URL itself.

ie.
https://UserName:Password@myaccount.somesite.com/stats.txt?login=<username>&passwd=<password>

Could this be the reason for getting login error?
0
 

Author Comment

by:cmjacques
ID: 8071825
Thanks very much aelatik!

Your solution worked perfectly.

Here are some points for you.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question