Website screenshot using php script

Hi All,

I would like to take the screenshot of the website page using a php script. What I’m expecting is a command where I can provide the URL, and it will create a screenshot in png or jpg format.

f.e php takescreenshot.php <url> <output_file> .

If anyone knows please help me.

Thanks in advance

http://php.net/manual/en/function.imagegrabscreen.php

Hi adolek17,

Thank you for your reply.

Is there any other way to take the screen shot using php in Linux ?

I think you can do it with Imagemagick but you need an x-server whatever that is.

There is a post on the Imagemagick forum and there may be others around.

I think it means you need a server with a windowing environment (so not just command line). You need a server somewhere that actually runs the site in a web browser so that an image can be saved and you can then grab the image.

I did this exact same thing about 4 years ago, and that’s pretty much the process we had to go through.

I think it means you need a server with a windowing environment (so not just command line).

You could be correct as there is a way of doing it in windows which opens a browser window; which I mentioned in the link in my post.

You can do it with wkhtmltoimage which is a command line application that uses the webkit engine