?
Solved

How to download text file by passing variables?

Posted on 2003-03-05
3
Medium Priority
?
134 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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, 15 hours left to enroll

765 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