How to Capture Screenshot of a Website Using PHP

Capturing website using PHP script is very easy. In this post, explain you how to capture screenshot using PHP code. We are using an PHP class “screenshot.class.php”. It will send an web request to ScreenshotLayer API to grab the website screenshot in JPG, GIF or PNG formats.

Steps to Capture Website Screenshot Using PHP Script

capture website screenshot using php

Get ScreenshotLayer API key:

Now you need the api key to access this class code. Using this api key an HTTP request send to screenshotLayer service to capture the screen.

To get api key SignUp here:

Use ScreenShotLayer Php Class code:

Use below screenshot.class.php code. Just use you own API-KEY in this file and include this file in your screen capture sample.php file.

Write PHP code to Capture Screen

You just write code for use this api call to take the website screenshot. Follow below “sample.php” file code for this.

Just get both files and upload it on website accessible location. Firstly image take some time capture. This api store your image for 30 days only untill you capture again.

You can also check complete ScreenshotLayer API documentation here: Implement any api method as  per your need. Its quite easy to implement this PHP code to Capture Web Screenshot.

Leave a Comment