PHP code example of beetpix / silverstripe-screenshot

1. Go to this page and download the library: Download beetpix/silverstripe-screenshot 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/ */

    

beetpix / silverstripe-screenshot example snippets


$url = \Beetpix\PrintScreen::inst()
    ->fullPage()
    ->getImage('https://www.example.com');

\Beetpix\PrintScreen::inst()
    ->downloadPDF('https://www.example.com');

$inst = \Beetpix\PrintScreen::inst()
    ->device('phone-landscape')
    ->click('.btn-accept-cookies')
    ->fullPage()
    ->flush();

// Get URL
$url = $inst->getImage('https://www.example.com');

// Download image
$inst->downloadImage('https://www.example.com');

// Read raw result
print_r($inst->getResult());