aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-09-09 03:57:04 -0400
committerTeddy Wing2016-09-09 03:57:04 -0400
commite2835b1a68252e1f9e37307f1d19ec7c56542095 (patch)
tree81cebbab098371670d2d0c898e3318cd4f1a46af
downloadirssi-slack-profile-e2835b1a68252e1f9e37307f1d19ec7c56542095.tar.bz2
Initial commit. Make an HTTP request.
Figured out how to make an HTTPS request in Perl. We'll need this structure in order to interact with the Slack Web API.
-rw-r--r--slack-profile.pl23
1 files changed, 23 insertions, 0 deletions
diff --git a/slack-profile.pl b/slack-profile.pl
new file mode 100644
index 0000000..813a838
--- /dev/null
+++ b/slack-profile.pl
@@ -0,0 +1,23 @@
+use strict;
+
+use LWP::UserAgent;
+use HTTP::Request::Common;
+use Mozilla::CA;
+
+my $ua = LWP::UserAgent->new;
+$ua->agent('Mozilla/5.0');
+
+my $req = HTTP::Request->new(GET => 'http://ip.jsontest.com/');
+
+$req->header('content-type' => 'application/json');
+
+my $resp = $ua->request($req);
+
+if ($resp->is_success) {
+ my $message = $resp->decoded_content;
+ print $message;
+}
+else {
+ print $resp->code . "\n";
+ print $resp->message . "\n";
+}