Solved

Imagegrab through php on locked computer

Posted on 2011-09-29
5
362 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 109

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how can i gnupg encrypt a PDF document? 12 27
UPDATE query not working in mysqli php 8 48
tutorial for ebay api 3 32
Decrypt string by php 7 27
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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.

813 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

15 Experts available now in Live!

Get 1:1 Help Now