Jump to content
tungpheng

Help me error HTTP.send()

Recommended Posts

tungpheng

I run my code use HTTP

Func _HttpCreate()
    Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    If @error Then
        Return SetError(1, 0, 0) ; ; error HTTP create error 1
    Else
        Return $oHTTP
    EndIf
EndFunc   ;==>_HttpCreate
Func _HttpGet(ByRef $oHTTP, $sURL, $sData = '')
    If NOT _IsInternetConnected() Then
        Return SetError(4, 0, 0) ; disconect error 4
    Else
        If $sData = '' Then
            $oHTTP.Open("GET", $sURL , False)
        Else
            $oHTTP.Open("GET", $sURL & "?" & $sData, False)
        EndIf
        If @error Then
            Return SetError(1, 0, 0)  ; error HTTP error 1
        Else

            __TestConnection()
            $oHTTP.Send()
            If @error Then
                Return SetError(2, 0, 0) ; error send error 2
            Else
                If $oHTTP.Status <> $HTTP_STATUS_OK Then
                    Return SetError(3, 0, 0) ; Status not OK error 3
                Else
                    Return SetError(0, 0, $oHTTP.ResponseText)
                EndIf
            EndIf
        EndIf
    EndIf
EndFunc   ;==>_HttpGet

I use func to check error and have information. picture In attachment

that is func

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
Func MyErrFunc()
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"    & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & hex($oMyError.number,8)  & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
             "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile     & @CRLF & _
             "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
Endfunc

Can anyone help me about that?

I dont know why have this error.

HTTP can request more request but at few moment later. thí error to stop script.

2222.png

Share this post


Link to post
Share on other sites
tungpheng

I try add line

If @error then

after line 

$oHTTP.Send()

But seems it can't do it

Share this post


Link to post
Share on other sites
tungpheng

OK I have way to pass that error.

I just Add Loop to doagain that func have http.send() when that passed to auto exit loop

While @error

Wend

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×