12 lines
251 B
Text
12 lines
251 B
Text
require('HTTP::Tiny')
|
|
|
|
func get(url) {
|
|
static ua = %O<HTTP::Tiny>.new(agent => 'Mozilla/5.0')
|
|
var resp = ua.get(url)
|
|
if (resp{:success}) {
|
|
return resp{:content}.decode_utf8
|
|
}
|
|
return nil
|
|
}
|
|
|
|
say get("http://rosettacode.org")
|