PDA

Click to See Complete Forum and Search --> : HTTP Protocol


johnsi
Feb 11th, 2000, 01:37 AM
How can we get the file size with the HTTP protocol
like http://mtv3.webjump.com/....zip ?
Please help
Thanx in advance
John

privoli
Feb 11th, 2000, 02:54 PM
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 (http://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
-------------------
privoli@bigpond.com
http://users.bigpond.com/privoli

johnsi
Feb 11th, 2000, 07:57 PM
Thanx privoli, thatīs great Wow
Thanx very much