PHP Script to Capture Screenshot of Website from URL
This article will give you an easy way to create a site image using the Google PageSpeed Insights API from the URL.

The above statement invokes the Google APIs to read the website's information at https://www.googleapis.com/...ine/v2/runPagespeed. This may take a while to get back to the data. And the information returned also contains other information that may be useful. This can be seen from the $ result (JSON) variable by removing this line comment.
The data can be used to other applications.
<?php
// URL ของเว็บไซต์ที่ต้องการอ่านข้อมูล
$url = "https://www.goragod.com/";
// เรียก PageSpeed API เพื่ออ่านข้อมูล อาจใช้เวลาสักครู่
$result = file_get_contents("https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url=$url&screenshot=true");
// แปลงผลลัพท์เป็น JSON
$result = json_decode($result, true);
// ตรวจสอบข้อมูลที่ส่งมา
//var_dump($result);
// ข้อมูล screenshot
$screenshot = str_replace(array('_', '-'),array('/', '+'), $result['screenshot']['data']);
// แสดงรูปภาพ
echo '<img src="data:image/jpeg;base64,'.$screenshot.'" />';

var_dump($result);
The data can be used to other applications.