Skip to content

Instantly share code, notes, and snippets.

@kimmel
Last active Oct 11, 2015
Embed
What would you like to do?
List a website's content encoding
#!/usr/bin/perl
use v5.16;
use warnings;
use autodie qw( :all );
use utf8::all;
use LWP::UserAgent;
use Data::Show;
my $url = 'http://reddit.com/r/linux/.json';
my $ua = LWP::UserAgent->new;
my $can_accept = HTTP::Message::decodable;
my $response = $ua->get( $url, 'Accept-Encoding' => $can_accept, );
show $response->{_headers};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment