1. Intercept the entire screen screenshot
Copy Code code as follows:
<?php
$im = Imagegrabscreen ();
Imagepng ($im, "myscreenshot.png");
?>
2. Intercepting a window Capture a Windows (IE for example)
Copy Code code as follows:
<?php
$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;
$browser->visible = true;
$im = Imagegrabwindow ($handle);
$browser->quit ();
Imagepng ($im, "iesnap.png");
$im = Imagegrabscreen ();
?>
3. Intercept IE Content Capture a window(IE for example) but and its content!
Copy Code code as follows:
<?php
$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;
$browser->visible = true;
$browser->navigate ("http://www.jb51.net");
* * Still working? */
while ($browser->busy) {
Com_message_pump (4000);
}
$im = Imagegrabwindow ($handle, 0);
$browser->quit ();
Imagepng ($im, "iesnap.png");
?>
4. Interception of IE Full-screen modeIE in fullscreen mode
Copy Code code as follows:
<?php
$browser = new COM ("Internetexplorer.application");
$handle = $browser->hwnd;
$browser->visible = true;
$browser->fullscreen = true;
$browser->navigate ("http://www.jb51.net");
* Is it completely loaded? (Be aware of frames!) */
while ($browser->busy) {
Com_message_pump (4000);
}
$im = Imagegrabwindow ($handle, 0);
$browser->quit ();
Imagepng ($im, "iesnap.png");
?>
This is how to use PHP com to call the IE window to open the Web page to screen, but a lot of friends to get the result is a picture of pure black, this is why?
There may be two scenarios, the first of which is that the COM component applies only to Windows servers, and the servers of other systems are not supported, because he does not have IE, and the second is not open to allow services to interact with the desktop! The second is the most common, open method is to click on the computer (My Computer)-> right-> management-> services and application-> services-> Apache (I use the Apache server)-> right key-> properties-&G T Login-> Login ID below both!