There are many cases when you may want to take a screenshot of a webpage from command line or programmatically from a PHP script or a .NET program.
In order to take screenshots in .NET you might use a WebBrowser control and saves an image rendered.
There are many command lines tools you can use to take a screenshots of a web page. See the list of tools here: in Windows, in Linux. The mentioned tools can be used on a from a php script using shell_exec function.
* If you are looking for taking screenshots programmatically in .NET – read the post Taking Screenshots of Websites with .NET Windows Forms.
There are many tools to take/capture screenshots from command line in Windows.
If you are looking for command line tools in Linux – read this post.
There are several ways to take screenshots in Linux. Most of them produce a WebKit, Gecko (Firefox) or khtml rendered screenshot image. Some of the methods require X session to open a window and take screenshots.
Read how to take screenshots from command line in Windows in this my post.