1

Below is the code that I am using to grab the screen shot of the entire webpage.

reference stackoverflow link (Website screenshots using PHP)

When I run this script from browser, All I get is a blank black image and not the screen shot of the webpage. Any help is greatly appreciated. Thanks!

<?php
header('Content-Type: image/jpeg');
$Browser = new COM('InternetExplorer.Application');
$Browserhandle = $Browser->HWND;
$Browser->Visible = true;
$Browser->Fullscreen = true;
$Browser->Navigate('http://google.com');

while($Browser->Busy){
  com_message_pump(4000);
}

$img = imagegrabwindow($Browserhandle, 0);
$Browser->Quit();
imagejpeg($img, 'screenshot3.jpg');
?>
Community
  • 1
  • 1
user2569524
  • 1,651
  • 7
  • 32
  • 57

1 Answers1

0

According to php.net ( http://php.net/manual/en/function.imagegrabwindow.php ):

the imagegrabwindow function "is only available on Windows."

Paul V
  • 351
  • 3
  • 9