|
-
Jun 18th, 2011, 01:10 AM
#1
Thread Starter
Addicted Member
[RESOLVED] why do i always have issues with winhtttp
It never fails just when i think i have all my little issues figured out with the help from this forum, i always run into yet another issue..
here's my problem now.
I use the following to get my pdf's file sizes so i know the size before i start the download,,
Code:
Set Req = New WinHttp.WinHttpRequest
Req.Option(WinHttpRequestOption_EnableRedirects) = True
Req.Open "HEAD", url, vbCrLf
Req.Send
Size = Req.GetResponseHeader("Content-Length")
Stats = Req.Status
only now the site that has the files has changed something,cause now i have to do a work around like this just to get the file size without downloading the whole file first.
Code:
Private Sub Req_OnResponseDataAvailable(Data() As Byte)
Req.Abort
End Sub
Private Sub Req_OnResponseStart(ByVal Status As Long, ByVal ContentType As String)
On Error Resume Next
Size = Req.GetResponseHeader("Content-Length")
Stats = Req.Status
End Sub
i had to add a timer set to at least 0.8 just keep the flow of information from screwing up and skipping files ,it works fine but it's sooo sloooow now
if i try and use HEAD on the site as before i get an error,,so i'm assuming they have blocked HEAD requests??? or something.
Could someone who knows a little more about winsock, or winhttp etc. help me find a faster alternative than what i'm doing in the second code..i can send you link to one of the pdf files, but i will send it only in a PM,,since the file and link are proprietary in nature.
Thanks ,
Rick
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|