Capture Screenshot of Website from URL using PHP (2021) – Programming Code Examples

Capture Screenshot of Website from URL using PHP (2021)4 min read

In this post, we gonna write a simple PHP script to grab the given website URL screenshot.

There are many solutions to capture screenshots of Web pages. Using the Google Page Speed API is often better because internally Google uses the Chrome browser to capture exactly the way pages are presented to users.

In this tutorial we gonna use Bootstrap for design. Let’s create an HTML form to collect URLs from the user.


HTML Code:

PHP script to generate a screenshot for a given URL

We gonna use google APIs to grab the website screenshot and the code is commented pretty well, just through the comments for better understanding.

Click here for API and create a request form here.

PHP Code:

All codes(sample.php):

Leave a Comment