Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!C:/perl/bin/perl.exe
- use lib "c:/perl/lib";
- use WebService::Browshot;
- my $browshot = WebService::Browshot->new(key => 'FdNaZZHjhcCUUMBJbqcTMMGpWVaKAD');
- my $screenshot = $browshot->screenshot_create(url => 'http://www.azer.com/');
- # wait until screenshot is done
- sleep 5;
- my $status = $browshot->screenshot_info(id => $screenshot->{id});
- while ($status->{status} ne 'finished' && $status->{status} ne 'error') {
- sleep 1;
- $status = $browshot->screenshot_info(id => $screenshot->{id});
- }
- # screenshot failed?
- if ($status->{status} eq 'error') {
- print "Screenshot failed\n";
- exit(0);
- }
- $browshot->screenshot_thumbnail_file(url => $status->{screenshot_url}, file => 'azwe.png'); # no width/height/scale mentionned, full screenshot retrieved
- print "Screenshot was saved to azwe.png\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement