PHP - How to capture screenshot of website from URL with example

PHP - How to capture screenshot of website from URL with example

In this PHP Tutorial, I am going to tell you how to capture screenshot of any website from URL.

There are many third party APIs are available to capture screenshot of the website using PHP script.

In this example, I am using Google APIs to capture screenshot from given url.

You can easily capture the screenshot using Google APIs.

Screenshot is a visual element that meant for capturing what’s immediately visible on the browser.

There are many reason to capture screenshot to report any issues of the website to admin.

Sometimes you make any bank transactions and you want to save the details of that transaction, then there you can use this script to capture screenshot.

URL must be valid url with "http".

Example :

  1. <?php
  2. $websiteURL = "http://www.expertphp.in/";
  3. $api_response = file_get_contents("https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url=$websiteURL&screenshot=true");
  4. //decode json data
  5. $result = json_decode($api_response, true);
  6. //screenshot data
  7. $screenshot = $result['screenshot']['data'];
  8. $screenshot = str_replace(array('_','-'),array('/','+'),$screenshot);
  9. //display screenshot image
  10. echo "<img src=\"data:image/jpeg;base64,".$screenshot."\" />";
  11. ?>

Phone: (+91) 8800417876
Noida, 201301
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort otele gelen escort sapanca escort söğütlü escort taraklı escort
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort karapürçek escort karasu escort kaynarca escort kocaali escort otele gelen escort pamukova escort sapanca escort söğütlü escort taraklı escort
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort karapürçek escort karasu escort kaynarca escort kocaali escort otele gelen escort pamukova escort sapanca escort söğütlü escort taraklı escort
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort karapürçek escort karasu escort kaynarca escort kocaali escort otele gelen escort pamukova escort sapanca escort söğütlü escort taraklı escort
sakarya escort serdivan escort adapazarı escort sakarya escort bayan sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sapanca escort sakarya escort