Last active
April 6, 2017 12:06
-
-
Save robhammond/c78e5eae9439ea03bded9c63dd46adff to your computer and use it in GitHub Desktop.
Quick script to ping the AMPProject CDN and refresh cache
This file contains hidden or 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 Modern::Perl; | |
use Mojo::UserAgent; | |
# Add list of URLs into @urls array | |
my @urls = qw(); | |
my $ua = Mojo::UserAgent->new; | |
for my $u (@urls) { | |
$u =~ s!^http://!!; | |
$u .= '.amp'; | |
$u = 'https://cdn.ampproject.org/update-ping/c/s/' . $u; | |
say $u; | |
my $tx = $ua->get($u); | |
if (my $res = $tx->success) { | |
say $res->code; | |
} else { | |
say $res->code; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment