Task

Send a GET request to obtain the resource located at the URL "https://www.w3.org/", then print it to the console.

Checking the host certificate for validity is recommended.

Do not authenticate. That is the subject of other tasks.

Readers may wish to contrast with the HTTP Request task, and also the task on HTTPS request with authentication.


OPTION TLS TRUE
website$ = "www.google.com"
 
OPEN website$ & ":443" FOR NETWORK AS mynet
 
SEND "GET / HTTP/1.1\r\nHost: " & website$ & "\r\n\r\n" TO mynet
WHILE WAIT(mynet, 1000)
    RECEIVE dat$ FROM mynet
    total$ = total$ & dat$
    IF REGEX(dat$, "\r\n\r\n$") THEN BREAK           : ' Quit receiving data when end indicator was reached
WEND
 
CLOSE NETWORK mynet
 
PRINT REPLACE$(total$, "\r\n[0-9a-fA-F]+\r\n", "\r\n", TRUE) : ' Remove chunk indicators from HTML data
 