Hi, I am wanting to grab a screenshot using PHP and on my local Vista machine. For starters I just wanted to get the standard example set up:
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.libgd.org");
/* Still working? */
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "iesnap.png");
imagedestroy($im);
When I run the script (command line), it opens up two IE windows. One (the first) remains empty and the second goes to the designated URL. The screenshot is taken, saved and the first window gets closed. The window that went to the URL remains open. The screenshot itself taken from the first, empty IE window.
How can I target the second window?
-- EDIT #1 -- After all the help from Breakthrough it still does not work on my system. :( For now I am going to try to work it out with: http://iecapt.sourceforge.net/ or http://cutycapt.sourceforge.net/ which both seem to work during preliminary testing. I am still interested in a "real" PHP solution.