Hi,
Is there any way of taking a screenshot of a website in PHP, then saving it to a file?
Thanks
Hi,
Is there any way of taking a screenshot of a website in PHP, then saving it to a file?
Thanks
I found this article that tells you how to do it (with code example). Scroll to the bottom to check it out.
http://www.plentyofcode.com/2007/09/website-screenshot-capture-with-aspnet.html
A website has to be rendered. PHP does not have website (HTML, CSS, JavaScript, etc) rendering capabilities. So no.
whit plain php - no, you have to use some browser extensions, like activeX and other.
Not directly. Software such as Selenium have features like this and can be controlled by PHP but have other dependencys (such as running their java-based server on the computer with the browser you want to screenshot)
Yes. You will need some things tho:
See khtmld(aemon) on *nx. See Url2Jpg for Windows but since it is dotNet app you should also chek Url2Bmp
Both are console tools that u can utilise from your web app to get the screenshot.
There are also web services that offer it. Check this out for example.
Edit:
This link is useful to.
It's in Python, but going over the documentation and code you can see exactly how this is done. If you can run python, then it's a ready-made solution for you:
Note that everything can run on one machine for one platform, or one machine with virtual machines running the other platforms.
Free, open source, scroll to bottom of page for links to documentation, source code, and other information.
Sure you can, but you'll need to render the page with something. If you really want to only use php, i suggest you HTMLTOPS, wich render the page and output it in a ps file (ghostscript), then, convert it in a .jpg, .png, .pdf.. can be little slower with complex pages (and dont support all the CSS).
Else, you can use wkhtmltopdf to output a html page in pdf, jpg, whaterver.. Accept CSS2.0, use the webkit (safari's wrapper) to render the page.. so should be fine. You have to install it on your server, as well..
EDIT: i noticed now that the wkhtmltopdf team is working on another project: wkhtmltoimage, that gives you the jpg directly
Shrink the web has always been what I've used. I think they have a nice API.
This ought to be good for you:
http://code.google.com/p/wkhtmltopdf/
Make sure you download the wkhtmltoimage distribution!
webkit2html works on Mac OS X and Linux, is quite simple to install and to use. See this tutorial.
For Windows, you can go with CutyCapt, which has similar functionality.