EDN Admin
Well-known member
Hi all
I use the code below to get images (jpg) form a secure web site (https) and has been working for years (from 2009) in a machine with Win 2000 and IE6. In win2000 and IE6 is still working.
Now I have to migrate to Win7 and IE8 and the thing isnt working properly. The byte array (responseBody) I get hasnt nothing I can "see"...
I have the code implemented in a VBA routine that I also migrate from Office 2000 to Office 2007.
I have reference the Microsoft XML v.6 in both machines.
Obviously Ivd get this code from a website and Ivd adapted to convinience...
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Public <span style="color:Blue; Function SACAIMG(FURLA <span style="color:Blue; As <span style="color:Blue; String, LOKALFILO <span style="color:Blue; As <span style="color:Blue; String) <span style="color:Blue; As <span style="color:Blue; String
<span style="color:Green; FURLA has the URL
<span style="color:Green; LOKALFILO as the path and filename
<span style="color:Blue; Dim oXMLHTTP <span style="color:Blue; As MSXML2.XMLHTTP
<span style="color:Blue; Dim Ii <span style="color:Blue; As <span style="color:Blue; Long
<span style="color:Blue; Dim vFF <span style="color:Blue; As <span style="color:Blue; Long
<span style="color:Blue; Dim oResp() <span style="color:Blue; As <span style="color:Blue; Byte
<span style="color:Green; You can also set a ref. to Microsoft XML, and Dim oXMLHTTP as MSXML2.XMLHTTP
<span style="color:Blue; Set oXMLHTTP = <span style="color:Blue; New MSXML2.XMLHTTP
oXMLHTTP.Open <span style="color:#A31515; "GET", FURLA, <span style="color:Blue; False <span style="color:Green; Open socket to get the website
oXMLHTTP.Send <span style="color:Green; send request
<span style="color:Green; Wait for request to finish
<span style="color:Blue; Do <span style="color:Blue; While oXMLHTTP.readyState <> 4
Sleep 200
DoEvents
<span style="color:Blue; Loop
oResp = oXMLHTTP.responseBody <span style="color:Green; Returns the results as a byte array
<span style="color:Green; Create local file and save results to it
vFF = FreeFile
<span style="color:Blue; If Dir(LOKALFILO) <> <span style="color:#A31515; "" <span style="color:Blue; Then
Kill LOKALFILO
Sleep 500
<span style="color:Blue; End <span style="color:Blue; If
Open LOKALFILO <span style="color:Blue; For Binary <span style="color:Blue; As #vFF
Put #vFF, , oResp
Sleep 100
Close #vFF
<span style="color:Green; Clear memory
SACAIMG = oXMLHTTP.StatusText
<span style="color:Blue; Set oXMLHTTP = <span style="color:Blue; Nothing
<span style="color:Blue; End <span style="color:Blue; Function
[/code]
Ivd already try lots of things IE8 setup, security with another dll nothing works...
The code works for another sites and images and still works in IE6 and win 2000 for the same site.
Any help wold be appreciated.
Joao.
<br/>
View the full article
I use the code below to get images (jpg) form a secure web site (https) and has been working for years (from 2009) in a machine with Win 2000 and IE6. In win2000 and IE6 is still working.
Now I have to migrate to Win7 and IE8 and the thing isnt working properly. The byte array (responseBody) I get hasnt nothing I can "see"...
I have the code implemented in a VBA routine that I also migrate from Office 2000 to Office 2007.
I have reference the Microsoft XML v.6 in both machines.
Obviously Ivd get this code from a website and Ivd adapted to convinience...
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Public <span style="color:Blue; Function SACAIMG(FURLA <span style="color:Blue; As <span style="color:Blue; String, LOKALFILO <span style="color:Blue; As <span style="color:Blue; String) <span style="color:Blue; As <span style="color:Blue; String
<span style="color:Green; FURLA has the URL
<span style="color:Green; LOKALFILO as the path and filename
<span style="color:Blue; Dim oXMLHTTP <span style="color:Blue; As MSXML2.XMLHTTP
<span style="color:Blue; Dim Ii <span style="color:Blue; As <span style="color:Blue; Long
<span style="color:Blue; Dim vFF <span style="color:Blue; As <span style="color:Blue; Long
<span style="color:Blue; Dim oResp() <span style="color:Blue; As <span style="color:Blue; Byte
<span style="color:Green; You can also set a ref. to Microsoft XML, and Dim oXMLHTTP as MSXML2.XMLHTTP
<span style="color:Blue; Set oXMLHTTP = <span style="color:Blue; New MSXML2.XMLHTTP
oXMLHTTP.Open <span style="color:#A31515; "GET", FURLA, <span style="color:Blue; False <span style="color:Green; Open socket to get the website
oXMLHTTP.Send <span style="color:Green; send request
<span style="color:Green; Wait for request to finish
<span style="color:Blue; Do <span style="color:Blue; While oXMLHTTP.readyState <> 4
Sleep 200
DoEvents
<span style="color:Blue; Loop
oResp = oXMLHTTP.responseBody <span style="color:Green; Returns the results as a byte array
<span style="color:Green; Create local file and save results to it
vFF = FreeFile
<span style="color:Blue; If Dir(LOKALFILO) <> <span style="color:#A31515; "" <span style="color:Blue; Then
Kill LOKALFILO
Sleep 500
<span style="color:Blue; End <span style="color:Blue; If
Open LOKALFILO <span style="color:Blue; For Binary <span style="color:Blue; As #vFF
Put #vFF, , oResp
Sleep 100
Close #vFF
<span style="color:Green; Clear memory
SACAIMG = oXMLHTTP.StatusText
<span style="color:Blue; Set oXMLHTTP = <span style="color:Blue; Nothing
<span style="color:Blue; End <span style="color:Blue; Function
[/code]
Ivd already try lots of things IE8 setup, security with another dll nothing works...
The code works for another sites and images and still works in IE6 and win 2000 for the same site.
Any help wold be appreciated.
Joao.
<br/>
View the full article