VBScript WinHTTPRequest Error "This method cannot be called until the Open method has been called"

29 Views Asked by At

I have the following code in VBScript:

On Error Resume Next 


Dim WinHttpReq, strFile, strMsg
dim Status, StatusText 

Set WinHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")  

WinHttpReq.open "GET", myURL, false   

WinHttpReq.SetCredentials GXP_USER_LOGIN,GXP_USER_PASSWORD,0
WinHttpReq.SetTimeouts 0,60000,60000,60000    
                          
WinHttpReq.Send 
If Err.Number <> 0 Then
    MsgBox "Error at Send() method :  " & Err.Description
End If
On Error GoTo 0

When I run the script, the msgbox displays the following error: "This method cannot be called until the Open method has been called""

I don't know why this error appears. I am already calling the Open() method before the Send() method...

0

There are 0 best solutions below