#!/usr/bin/perl -w

use strict;
use warnings;
use Carp;

use WebService::Browshot;

#######################
# WARNING
# Running this code sample will cost you Browshot credits
#######################


my $browshot = WebService::Browshot->new(
	key	=> 'my_api_key',
	debug	=> 1, # print more debug information
);

my ($code, $file) = $browshot->simple_file(url => 'http://www.google.com/', file => '/tmp/google-640.png', width => 640, height => 480);

if ($file eq '' || $code != 200) {
  print "Screenshot failed\n";
}
else {
  print "Thumbnail saved at $file\n";
}