Screenshot via PHP?
Moderator: General Moderators
Screenshot via PHP?
This is a rather odd request, but I was wondering if I could go to a script on a webpage and it would run a program on my computer then show the file with a content-type of a jpg. Is this at all possible to even run a program on my computer?
Code: Select all
<?php
$neoShooter = "neoshooter.exe /shootnow";
chdir("*FILEPATH*/neoshooter403/");
exec($neoShooter);
?>Well it very customised as it auto reads url's from a database, grabs the shot, sizes it to a large and small shot then ftp's it to a remote site and it also uses winbinder for it's gui interface and php_dhtml for the actual IE side of it (it's easier on *nix but i have no choice but to use windows for this :0). If you're not grabbing website screenshots, only a desktop screenshot then it's easier as you don't need the IE/COM part of the below.
But, having said that the actual grabbing of a screenshot it relatively simple.
First you need to grab the screenshot: i use php_dhtml for this but a simple COM call to load an IE window with a url will do. Then i do an exec call along the lins of 'grab -f foo.bmp -t bar' where bar is the title of the IE window. If you're just grabbing a desktop shot then see the grab url above for the arguments to grab the whole desktop.
Then i use ImageMagicks convert utility to do the resizing...again see the docs for convert for the relevant command line arguments.
I might have made this seem a bit complex but it's really just a case of grabbing then converting both of which use exec() to shell out a command to grab and convert respectively. Hope this help a little
But, having said that the actual grabbing of a screenshot it relatively simple.
First you need to grab the screenshot: i use php_dhtml for this but a simple COM call to load an IE window with a url will do. Then i do an exec call along the lins of 'grab -f foo.bmp -t bar' where bar is the title of the IE window. If you're just grabbing a desktop shot then see the grab url above for the arguments to grab the whole desktop.
Then i use ImageMagicks convert utility to do the resizing...again see the docs for convert for the relevant command line arguments.
I might have made this seem a bit complex but it's really just a case of grabbing then converting both of which use exec() to shell out a command to grab and convert respectively. Hope this help a little
When I go to run->cmd->grab -f picture.bmp -p -t Program manager I get a picture, but when i execute
I get nothing... any ideas?
But when I do
I get the full help
I'm running an apache server... is it possible that thats the reason i can't get to the regular command prompt for my computer?
Code: Select all
<?
exec("grab -f picture.bmp -p -t Program manager");
?>But when I do
Code: Select all
<?
shell_exec("grab -h");
?>I'm running an apache server... is it possible that thats the reason i can't get to the regular command prompt for my computer?