Results 1 to 5 of 5

Thread: Downloading files off a webpage from within VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Cape Town, South Africa
    Posts
    14

    Downloading files off a webpage from within VB

    ID like to find out how to download a file from a webpage to my PC using Winsoc. Any ideas?
    Bartho Smith
    Email: [email protected]

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Assuming you already know the basics of Winsock, connect to a web server at port 80 and send the following string:

    "GET /page.html HTTP/1.0" & vbcrlf & vbcrlf

    The incoming data will be the page. You'll have to keep appending it to a string until the connection closes - the file can come in "chunks". Then strip out the HTTP headers (everything up to and including the first two vbcrlf's), and save it to disk.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Cape Town, South Africa
    Posts
    14
    What does the folowing mean and what do I need to do o correct it.
    This is what I receive when sending the string you suggested.

    HTTP/1.0 401 Unauthorized
    WWW-Authenticate: Basic realm="FW-1. Reason: no user Server "
    Content-Type: text/html
    Content-Length: 323

    <TITLE>Error</TITLE>
    <BODY>
    <H1>Error 401</H1>

    FW-1 at primaryfw1: Unauthorized to access the document.<BR><BR><LI>Authorization is needed for FW-1.<BR><BR><LI>The authentication required by FW-1 for the user is: <STRONG>unknown</STRONG>.<BR><BR><LI>Reason for failure of last attempt: <STRONG>no user</STRONG>
    </BODY>
    Bartho Smith
    Email: [email protected]

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    It means you need to send a valid username and password to access the page.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Location
    Cape Town, South Africa
    Posts
    14

    How do I sent the user name etc

    How do I sent the user name and password?
    Bartho Smith
    Email: [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width