Skip to content

Instantly share code, notes, and snippets.

@kimmel
Last active October 11, 2015 21:47
Show Gist options
  • Save kimmel/3924279 to your computer and use it in GitHub Desktop.
Save kimmel/3924279 to your computer and use it in GitHub Desktop.
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