Sometimes, we want to take website screenshots with PHP.
In this article, we’ll look at how to take website screenshots with PHP.
How to take website screenshots with PHP?
To take website screenshots with PHP, we can use imagegrabscreen
.
For instance, we write
$img = imagegrabscreen();
imagepng($img, 'screenshot.png');
to call imagegrabscreen
to grab the screenshot of the current page.
Then we call imagepng
to save the screenshot $img
as screenshot.png.
Conclusion
To take website screenshots with PHP, we can use imagegrabscreen
.