nill Posted June 27, 2020 Share Posted June 27, 2020 Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", 'https://api.reg.ru/api/regru2/zone/clear', False) $oHTTP.Send() I load this link and get an error, although the same code and any other link are loaded without an error, what is wrong with the link? Link to comment Share on other sites More sharing options...
orbs Posted June 27, 2020 Share Posted June 27, 2020 (edited) first step is to add error handling to your script. for objects, that would be "COM error handler", you can simply copy it from the help file example for ObjEvent(), like so: Local $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", 'https://api.reg.ru/api/regru2/zone/clear', False) $oHTTP.Send() Func _ErrFunc() ; 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 run your code and look at the console output. continue investigating from there. Edited June 27, 2020 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
nill Posted June 27, 2020 Author Share Posted June 27, 2020 err.number is: 0x80020009 err.windescription: Ошибка. err.description is: Для проверки подлинности клиента требуется сертификат err.source is: WinHttp.WinHttpRequest err.helpfile is: err.helpcontext is: 0 err.lastdllerror is: 0 err.scriptline is: 7 err.retcode is: 0x80072F0C translate err.description is: Client authentication certificate required What I can do with this? Link to comment Share on other sites More sharing options...
Developers Jos Posted June 27, 2020 Developers Share Posted June 27, 2020 (edited) This means you probably need some sort of Token in a cookie for authentication (oAuth or similar) which you haven't done first. When you use the browser, does it require to login at some stage? Jos Edited June 27, 2020 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...
nill Posted June 27, 2020 Author Share Posted June 27, 2020 if you just download the link without login, it will give an answer in json format As I understand it, the answer should be without a login this is what i get in brouser without login { "charset" : "utf-8", "error_code" : "NO_AUTH", "error_params" : { "command_name" : "zone/clear" }, "error_text" : "No authorization mechanism selected", "messagestore" : null, "result" : "error" } 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