Results 1 to 3 of 3

Thread: HTTP Protocol

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 1999
    Posts
    3

    Post

    How can we get the file size with the HTTP protocol
    like http://mtv3.webjump.com/....zip ?
    Please help
    Thanx in advance
    John

  2. #2
    Lively Member
    Join Date
    Nov 1999
    Location
    Melbourne, Victoria, Australia
    Posts
    126

    Post

    When you talk to a webserver and ask it for a file it will return several lines of information then the actual file you asked for comes though.

    Try this..

    Start, Run, "telnet www.vb-world.net 80"
    (Click OK)

    Telnet will open and connect, when it is connected type in...

    GET / HTTP/1.0

    and press enter twice...
    You will see something like...

    HTTP/1.1 200 OK
    Date: Sat, 12 Feb 2000 08:50:23 GMT
    Server: Apache/1.3.9 (Unix) PHP/3.0.12
    Connection: close
    Content-Type: text/html
    Content-Length: 18194

    Thats the HTTP header, the "Content-Length" will indicate how many bytes long the file is.

    If you want to know how big the file "msie5.exe" on microsoft server is you would do...

    on CmdConnect_Click()
    sckSocket.connect "www.microsoft.com", 80
    End Sub

    on SckSocket_Connect()
    sckSocket.senddata "GET /downloads/files/ie5/msie5.exe HTTP/1.0" & vbcrlf & vbcrlf
    End Sub

    on SckSocket_DataArrival(bytes as long)
    sckSocket.getdata TempStr, vbstring
    'here is where u need to scan for "Content-Length" and trap accordingly
    End Sub


    ------------------
    Regards,

    Paul Rivoli
    -------------------
    [email protected]
    http://users.bigpond.com/privoli

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 1999
    Posts
    3

    Post

    Thanx privoli, that´s great Wow
    Thanx very much

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