Taking screenshot of a website using PHP on windows os
I have been trying to figure out a way using I could take a screenshot of any provided URL using PHP. Finally I could find out a way of doing it and that is by using the COM object on windows os. I have written a class for taking the screenshot. For using it, all you need to do is:
Download the class file from here. Rename it and remove the .txt entention Include the class file in the required script. And then, Create a new object:
$s = new akjScreenshot(“http://amanjain.com”);
Resize if required:
$s->toWidth(100); $s->toHeight(100);
Save:
$s->save(“screen.jpg”);
You can also save it in different formats like:
$s->save(“screen.png”, “png”); $s->save(“screen.gif”, “gif”); I hope it helps :) Please leave a comment if you find it useful.