Solved

Imagegrab through php on locked computer

Posted on 2011-09-29
5
374 Views
Last Modified: 2012-05-12
Hello,

I have the following code for taking screenshots of a website using php. The problem is that I want these screenshots to be taken through a remote computer (a dedicated server) and the image is not taken if I don't have the computer open with the remote desktop. The user is logged in but if the window of the remote desktop is not opened on my computer the screenshot appears black. I tried even to schedule the script to run from the remote computer but that didn't work as well.

Any ideas?

$Browser = new COM('InternetExplorer.Application');
$Browserhandle = $Browser->HWND;
$Browser->Visible = true;
$Browser->Fullscreen = true;
$Browser->Navigate('http://www.mysite.com');
while ($Browser->Busy) {
com_message_pump(8000);
}
$img = imagegrabwindow($Browserhandle, 0);
$Browser->Quit();
imagejpeg($img, 'screenshot.jpg', 100);

Open in new window

0
Comment
Question by:infodigger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 260 total points
ID: 36813888
You might want to contact these folks and see if they can offer any suggestions.
http://www.shrinktheweb.com/
0
 
LVL 8

Assisted Solution

by:rationalboss
rationalboss earned 240 total points
ID: 36813893
That requires the browser in the dedicated server to be open and to be on focus because it takes a screenshot of what the browser sees.

How about using this instead?
http://de77.com/php/php-class-get-screenshot-thumbnail-of-any-website
0
 
LVL 8

Assisted Solution

by:rationalboss
rationalboss earned 240 total points
ID: 36813899
you may also try thumbalizr.
code here: https://github.com/mptre/thumbalizr (site at thumbalizr.com)

http://www.shrinktheweb.com/ too takes screenshot - they have both free and paid API.

http://www.websnapr.com/ is also very easy to use, it provides screenshot of the site

If you have a linux box, try using wkhtmltoimag.
Details here: http://www.codediesel.com/php/taking-screenshots-of-websites-in-php/

hope this helps :)
0
 

Author Comment

by:infodigger
ID: 36813923
Forgot to mention that the page I want to take screenshots of, has flash also. I tried the wkhtmltoimag solution and some API's for screenshots and didn't work.

Any other way, even command line could work for me if you have anything in mind.

Thank you very much!
0
 

Author Closing Comment

by:infodigger
ID: 36814051
Thank you! I finally found what I was looking for at shrinktheweb.com.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question