Created
May 22, 2021 16:31
-
-
Save sironekotoro/adff3639f3be94723b88fe1862b48705 to your computer and use it in GitHub Desktop.
AWS Lambda Sample(http)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Encode qw/decode/; | |
use HTTP::Tiny; | |
my $url = 'http://abehiroshi.la.coocan.jp/'; | |
my $ht = HTTP::Tiny->new(); | |
sub handler{ | |
my $res = $ht->get($url); | |
my $content = decode('shiftjis', $res->{content}); | |
$content =~ /<title>(?<title>.+?)<\/title>/; | |
return { | |
status => $res->{status}, | |
title => $+{title}, | |
} | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment