Wednesday, April 17, 2013

Take screenshot of your web page in Php using Internet Explorer

<?php
$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();
imagepng($img, 'screenshot.png');
?>

Just Run this code in Your IE Browser you will get the screenshot

You should do 2 things

1. Pls give your web link here $Browser->Navigate('http://google.com');

2.  Pls give image name what you want imagepng($img, 'screenshot.png');

Enjoy it ....

No comments:

Post a Comment