haijie1223 Posted March 17, 2018 Share Posted March 17, 2018 Local $url = 'https://www.google.com/' Local $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHttp.Open('GET', $url, True) $oHttp.Send() $oHttp.WaitForResponse() Local $NetData = BinaryToString($oHttp.ResponseBody, 4) ConsoleWrite($NetData) like above code,In the 3.3.13.12 is Right。 but in the 3.3.14.0,3.3.14.2,3.3.14.3,3.3.14.4,3.3.14.5 version,is error As shown below. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 17, 2018 Developers Share Posted March 17, 2018 (edited) @haijie1223, Moved to the appropriate forum, as the DEV forum very clearly states: Quote Do not create AutoIt-related topics here, use AutoIt General Help and Support Jos Edited March 17, 2018 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Danyfirex Posted March 17, 2018 Share Posted March 17, 2018 (edited) Hello. Add a COM Error handler to check the issue. I think its a timeout problem probably you can set a higher timeout for the response. Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $sUrl = 'https://www.google.com/' Local $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHttp.SetTimeouts(0, 60000, 30000, 130000) ;$oHttp.SetTimeouts(ResolveTimeout, ConnectTimeout, SendTimeout, ReceiveTimeout) ;Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/aa384061(v=vs.85).aspx $oHttp.Open('GET', $sUrl, True) $oHttp.Send() Local $x=$oHttp.WaitForResponse() Local $NetData = BinaryToString($oHttp.ResponseBody, 4) ConsoleWrite($NetData) ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Saludos Edited March 17, 2018 by Danyfirex Fix Code Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
TheXman Posted March 17, 2018 Share Posted March 17, 2018 (edited) The code you posted works just fine for me so Danyfirex is probably right about possibly timing out and that you should add COM error handling. I forgot to mention that I am using AutoIt v3.3.14.5. Common things that will cause that error are things like not being able to resolve the address or timing out. If you use async mode, you will get the error on the WaitForResponse() method. If you use sync mode, you will get the same error on the Send() method. Unless for some reason you absolutely have to use ASYNC mode, if you use synchronous mode, then the Send() method will wait until the response is received - you will not need the WaitForResponse() method. To use synchronous mode, change the 3rd parameter in the Open method from TRUE to FALSE and remove the WaitForResponse. Local $url = 'https://www.google.com/' Local $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHttp.Open('GET', $url, False) $oHttp.Send() ;~ $oHttp.WaitForResponse() Local $NetData = BinaryToString($oHttp.ResponseBody, 4) ConsoleWrite($NetData) https://msdn.microsoft.com/en-us/library/windows/desktop/aa383989(v=vs.85).aspx Edited March 17, 2018 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
haijie1223 Posted March 17, 2018 Author Share Posted March 17, 2018 @DanyfirexThanks,but 3.3.13.12 version is not error with no set timeout。3.3.14.3 set higher timeout is error too。 Link to comment Share on other sites More sharing options...
haijie1223 Posted March 17, 2018 Author Share Posted March 17, 2018 @TheXman thanks,but synchronous mode is error as same as asynchronous mode。 Link to comment Share on other sites More sharing options...
TheXman Posted March 17, 2018 Share Posted March 17, 2018 What happens when you try to go to https://www.google.com in a browser? Are you going through a proxy server? CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now