I am trying to run a VBScrpit to download a file daily from a website. In order to do this I need to set the proxy credentials. THe scrpit below works inside the network, and I have verified that the two URLs are accurate (if put in IE both go where I want) but after I enter my proxy credentials and do a .send the object status returns HTTP Error 407 (proxy authorization required) I know that the credentials I have are what I enter manually, although I reliase that it may not be the full username. Also I cant bypass the proxy because the website verifies the IP address before allowing me to login. Any suggestions?
Dim sFileURL, objXMLHTTP, objADOStream, objFSO, sLocation, username, password,url
username = "my username"
password = "my password"
sFileURL = "Login URL"
sLocation = "Path"
url = "File URL"
Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
objXMLHTTP.setProxy 2, "my proxy"
objXMLHTTP.Open "GET", sFileURL, False
objXMLHTTP.setProxyCredentials username, password
If objXMLHTTP.Status <> 200 Then
objXMLHTTP.Open "GET", url, False
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Type = 1
objADOStream.Position = 0
Set objFSO = CreateObject
If objFSO.FileExists(sLocation) Then
Set objFSO = Nothing
Set objADOStream = Nothing
Set objXMLHTTP = Nothing