Is there any way of taking a screenshot of a website in PHP, then saving it to a file?
After a lot for surfing on web I found this.
PPTRAAS > A free tool to capture screenshot by passing your URL as a parameter
They provide multiple options by simply hitting their URL.
Get full page screenshot
https://pptraas.com/screenshot?url={YOU URL HERE}
Get page screenshot of specific size
https://pptraas.com/screenshot?url={YOU URL HERE}&size=400,400
One can even convert the page to pdf
https://pptraas.com/pdf?url={YOU URL HERE}
I used bluga. The api allows you to take 100 snapshots a month without paying, but sometimes it uses more than 1 credit for a single page. I just finished upgrading a drupal module, Bluga WebThumbs to drupal 7 which allows you to print a thumbnail in a template or input filter.
The main advantage to using this api is that it allows you to specify browser dimensions in case you use adaptive css, so I am using it to get renderings for the mobile and tablet layout as well as the regular one.
There are api clients for the following languages:
PHP, Python, Ruby, Java, .Net C#, Perl and Bash (the shell script looks like it requires perl)