Solved

Imagegrab through php on locked computer

Posted on 2011-09-29
5
360 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
  • 2
  • 2
5 Comments
 
LVL 108

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

919 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now