PHP code example of screenshotone / sdk

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

    

screenshotone / sdk example snippets


 

// If you don't use Composer in your project, please, read https://getcomposer.org/doc/01-basic-usage.md#autoloading. 
// You need the Composer autoloader to use the API SDK.

// ...

use ScreenshotOne\Sdk\Client;
use ScreenshotOne\Sdk\TakeOptions;

$client = new Client('M73PaLOC8lchKQ', 'VjuscNqAfGCC4A');

$options = TakeOptions::url("https://example.com")
    ->fullPage(true)
    ->delay(2)
    ->geolocationLatitude(48.857648)
    ->geolocationLongitude(2.294677)
    ->geolocationAccuracy(50);

$url = $client->generateTakeUrl($options);
echo $url.PHP_EOL;
// expected output: https://api.screenshotone.com/take?url=https%3A%2F%2Fexample.com...

$image = $client->take($options);
file_put_contents('example.png', $image);