views:

1705

answers:

5

I know there is not a direct way to take a screen shot of a web page with PHP. What would be the most straightforward way to accomplish this? Are there any command line tools that could do this that I might be able to execute from a PHP script (I'm thinking something that would run in a 'NIX OS (OS X and/or Linux in particular)?

Edit: Or maybe some sort of web service I could access via SOAP or REST or ...

Edit #2: I found a related question discussing the CLI option, but I'd still be open to other methods if anyone knows of anything.

A: 

Not sure if this would be enough for you, because it has some added stuff there, but would be worth giving it a try: http://www.snap.com

Seb
A: 

You can use the GD functions imagegrabscreen() or imagegrabwindow() to take a screenshot, but they're only available on Windows at the moment.

Greg
A: 

http://www.thumbshots.org/

vartec
+1  A: 

html2ps does a decent job for relatively simple pages, and it requires very little in terms of external binaries, meaning it's very easy to install/use. If you control the pages you'll be capturing, then you can ensure that they'll render appropriately in html2ps. If you're hoping to capture arbitrary URLs, however, I'm not sure that the PHP port of HTML2PS is up to the task. It's also not the fastest thing in the world (expect render times in the seconds for complex pages), but that doesn't really matter for some applications.

Frank Farmer
A: 

See webkit2png for an OSX commandline program that does this.

The page also mentions Linux alternatives.

Epskampie