RosettaCodeData/Task/HTTPS/Sidef/https.sidef

17 lines
387 B
Text
Raw Permalink Normal View History

2023-12-16 21:33:55 -08:00
require('LWP::UserAgent')
require('LWP::Protocol::https')
2023-07-01 11:58:00 -04:00
2023-12-16 21:33:55 -08:00
func get(url) {
static ua = %O<LWP::UserAgent>.new(
agent => 'Mozilla/5.0',
ssl_opts => Hash(verify_hostname => 1),
)
var resp = ua.get(url)
if (resp.is_success) {
return resp.decoded_content
}
die "Failed to GET #{url}: #{resp.status_line}"
}
2023-07-01 11:58:00 -04:00
2023-12-16 21:33:55 -08:00
say get("https://rosettacode.org")