Solved

Imagegrab through php on locked computer

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

758 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

20 Experts available now in Live!

Get 1:1 Help Now