1. Go to this page and download the library: Download screenshotmax/sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
screenshotmax / sdk example snippets
use ScreenshotMax\SDK;
use ScreenshotMax\Options\ScreenshotOptions;
$sdk = new SDK('<ACCESS_KEY>', '<SECRET_KEY>');
$opts = new ScreenshotOptions();
$opts->url = 'https://example.com';
$opts->format = 'png';
$sdk->screenshot->setOptions($opts);
$url = $sdk->screenshot->getUrl();
$result = $sdk->screenshot->fetch();
file_put_contents('screenshot.png', $result['data']);
use ScreenshotMax\SDK;
use ScreenshotMax\Options\ScrapeOptions;
$sdk = new SDK('<ACCESS_KEY>', '<SECRET_KEY>');
$opts = new ScrapeOptions();
$opts->url = 'https://example.com';
$opts->format = 'html';
$sdk->scrape->setOptions($opts);
$url = $sdk->scrape->getUrl();
$result = $sdk->scrape->fetch();
file_put_contents('scrape.html', $result['data']);
use ScreenshotMax\SDK;
use ScreenshotMax\Options\PDFOptions;
$sdk = new SDK('<ACCESS_KEY>', '<SECRET_KEY>');
$opts = new PDFOptions();
$opts->url = 'https://example.com';
$opts->pdf_paper_format = 'a4';
$sdk->pdf->setOptions($opts);
$url = $sdk->pdf->getUrl();
$result = $sdk->pdf->fetch();
file_put_contents('pdf.pdf', $result['data']);
use ScreenshotMax\SDK;
$sdk = new SDK('<ACCESS_KEY>', '<SECRET_KEY>');
# get all tasks from account
$tasks = $sdk->task->get_tasks()
print_r($tasks['data']);
/* {"tasks":[{
"id":5678133109850112,
"name":"Test CRON",
"api":"screenshot",
"query":
"url=https%3A%2F%2Fexample.com",
"frequency":"every_day",
"crontab":"25 13 * * *",
"timezone":"Etc/UTC",
"enabled":true,
"created":1747229104,
"last_run":1748611516,
"runs":18}]}
*/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.