One way to take a screenshot of a URL in PHP is to use a headless browser like PhantomJS. Here's an example code:
main.php344 chars14 lines
Note that this code requires a rasterize.js
file, which is a script that comes with the PhantomJS package. You can find it in the examples/
directory. Alternatively, you can use a pre-made PHP library that wraps around PhantomJS, such as jonnnnyw/php-phantomjs
.
gistlibby LogSnag