RosettaCodeData/Task/HTTPS/BaCon/https.bacon

16 lines
473 B
Text
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
OPTION TLS TRUE
website$ = "www.google.com"
2018-08-17 15:15:24 +01:00
2019-09-12 10:33:56 -07:00
OPEN website$ & ":443" FOR NETWORK AS mynet
2018-08-17 15:15:24 +01:00
2019-09-12 10:33:56 -07:00
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
2018-08-17 15:15:24 +01:00
CLOSE NETWORK mynet
2019-09-12 10:33:56 -07:00
PRINT REPLACE$(total$, "\r\n[0-9a-fA-F]+\r\n", "\r\n", TRUE) : ' Remove chunk indicators from HTML data