0

i had this code that retrieved data from docuwiki :). but they started using tls1.3 and my code doesn't work anymore. is there anything i can do? i have win 7 and i'm using excel 2007 the error i'm getting when running the vba script is "an error occurred in the secure channel support"

Sub test1()

Dim Http2 As New WinHttpRequest

    'open the docuwiki url
    Http2.Open "GET", "https://9gag.com/", False
    Http2.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:25.0) Gecko/20100101 Firefox/25.0"

    'send request
    Http2.send

    'get response
    a = lcase(Http2.responseText)
    MsgBox a
End Sub

i apologise if this is a stupid or incomplete question.

QHarr
  • 83,427
  • 12
  • 54
  • 101
  • 2
    Hi militon. You provided too little details to help you with this problem. TLS communication is advanced topic, that requires much more details than that. Please provide error message with all the details – Tinki Jul 25 '20 at 10:43
  • sorry. i didn't include the whole error message because i thought the numbers before were synonym with the text message. anyway, when i run my script from excel, it breaks down on the http2.send line, and there's an error window titled "microsoft visual basic" with the text:Run-time error '-2147012739 (80072f7d)': An error occurred in the secure channel support – militon the sane Jul 25 '20 at 13:04
  • perhaps i should mention that i tested my code and it works well to get data from http websites and even most https websites, but breaks down for this particular website (https://docuwiki.net). this is why i thought the problem had something to do with the fact that they're using tls1.3, and thought maybe someone had run into the same problem. – militon the sane Jul 25 '20 at 13:13
  • please provide complete code, when i tested to get a result from `docuwiki.net` with Excel2013, i managed to get an HTML page. When testing on the command-line using `curl` i got an error message (from the website) stating that tls1.3 is not yet supported. – Luuk Jul 25 '20 at 13:41
  • Also, change URL to `https://docuwiki.net/index.php?title=A_life_among_monkeys` otherwise the first result will be a `HTTP/1.1 301 Moved Permanently` – Luuk Jul 25 '20 at 13:44
  • in my attempts to identify the problem, i stripped down my code to that. if i use, say, https://9gag.com/ as the url, it works (the variable a contains the page source). if i use the docuwiki.net link, i get the error. i tried using the link you mentioned (with the capitalised A), but i get the same error. i have edited the original question to include the whole code. maybe excel2007 is the problem, or my windows. – militon the sane Jul 25 '20 at 14:36
  • I have no problem with your code and using either of your urls (windows 10 and Excel 2019) – QHarr Jul 25 '20 at 16:38
  • Does this link help you? I think it's not VBA's problem, but it's your PC's OS level problem. https://stackoverflow.com/questions/44045305/vba-an-error-occurred-in-the-secure-channel-support – yamashiro.akihito Jul 26 '20 at 05:18

0 Answers0