Advertisement
Guest User

Untitled

a guest
Mar 28th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #!C:/perl/bin/perl.exe
  2. use lib "c:/perl/lib";
  3. use WebService::Browshot;
  4.  
  5. my $browshot = WebService::Browshot->new(key => 'FdNaZZHjhcCUUMBJbqcTMMGpWVaKAD');
  6. my $screenshot = $browshot->screenshot_create(url => 'http://www.azer.com/');
  7.  
  8. # wait until screenshot is done
  9. sleep 5;
  10. my $status = $browshot->screenshot_info(id => $screenshot->{id});
  11. while ($status->{status} ne 'finished' && $status->{status} ne 'error') {
  12. sleep 1;
  13. $status = $browshot->screenshot_info(id => $screenshot->{id});
  14. }
  15.  
  16. # screenshot failed?
  17. if ($status->{status} eq 'error') {
  18. print "Screenshot failed\n";
  19. exit(0);
  20. }
  21.  
  22. $browshot->screenshot_thumbnail_file(url => $status->{screenshot_url}, file => 'azwe.png'); # no width/height/scale mentionned, full screenshot retrieved
  23. print "Screenshot was saved to azwe.png\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement