|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VBA to HttpWebRequestHttpWebRequest to do the same job. I get a logon failed error. Can anyone craft an example from this info? Sub Get1Report() Dim doc As Object 'For storing the downloaded report Dim s$ ' The string sent to the server for retrieving the report Dim direc$ ' Where to store the downloaded ZIP file (for version=4) Dim filenumber# ' For writing to the ZIP file Dim myfile ' For iterating through the ZIP file Dim sUserName As String Dim sPassword As String sUserName = "XXXX" sPassword = "XXXX" Set doc = CreateObject("msxml2.ServerXMLHTTP") doc.Open "POST", "https://www.Host.com/export.jsp", False doc.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" s = "user=" & sUserName & "&password=" & sPassword & "&version=4&date=20060103&format=csv&report=ReportName&type=XDS" ' Send the request to the web site doc.send (s) ' Handle the response If (Left$(doc.responseText, 2) = "PK") Then ' A ZIP file On Error Resume Next direc = "D:\RNGData\download" MkDir direc On Error GoTo 0 MkDir direc filenumber = FreeFile Open direc & "\file.zip" For Binary Access Write As #filenumber Put #filenumber, 1, doc.responseBody Close #filenumber Set doc = Nothing End If Set doc = Nothing End Sub <markand***@dbs.com> schrieb:
>I hae the following VBA script that works fine but I cannot get <URL:http://dotnet.mvps.org/dotnet/code/net/#CookieRequest>> HttpWebRequest to do the same job. I get a logon failed error. > >[...] > Set doc = CreateObject("msxml2.ServerXMLHTTP") > doc.Open "POST", "https://www.Host.com/export.jsp", False > doc.setRequestHeader "Content-Type", > "application/x-www-form-urlencoded" > > s = "user=" & sUserName & "&password=" & sPassword & > "&version=4&date=20060103&format=csv&report=ReportName&type=XDS" > ' Send the request to the web site > doc.send (s) -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
alter built-in ContextMenu
Microsoft doesn't want you to use VB .Net Unmanaged C dll call The connection is dead XML question WIA.ImageFile to System.Drawing.Image How to loop thru each controls ? Using VB Keywords In An Enum Statement Developing Application like Photoshop Serializing / persistently storing & retrieving VB objects in & from SQL Server |
|||||||||||||||||||||||