27 lines
1.2 KiB
PHP
27 lines
1.2 KiB
PHP
<?php
|
|
$customer_key = "01a38f";
|
|
$secret_phrase = "testTech4BizPvtLtdSolu"; //leave secret phrase empty, if not needed
|
|
|
|
$machine = new ScreenshotMachine($customer_key, $secret_phrase);
|
|
|
|
//mandatory parameter
|
|
$options['url'] = "tech4biz.io";
|
|
|
|
// all next parameters are optional, see our website screenshot API guide for more details
|
|
$options['dimension'] = "1920xfull"; // or "1366xfull" for full length screenshot
|
|
$options['device'] = "desktop";
|
|
$options['format'] = "jpg";
|
|
$options['cacheLimit'] = "0";
|
|
$options['delay'] = "200";
|
|
$options['zoom'] = "100";
|
|
$api_url = $machine->generate_screenshot_api_url($options);
|
|
// $api_url = 'https://api.screenshotmachine.com?key=01a38f&url=tech4biz.io&dimension=1920xfull&format=jpg&cacheLimit=0&delay=0&zoom=0&crop=600';
|
|
// https://api.screenshotmachine.com?key=01a38f&url=tech4biz.io&dimension=1920xfull&format=jpg&cacheLimit=0&delay=0&zoom=0&crop=600
|
|
// https://api.screenshotmachine.com?key=01a38f&url=screenshotmachine.com&dimension=1024x768
|
|
//put link to your html code
|
|
echo '<img src="' . $api_url . '">' . PHP_EOL;
|
|
|
|
//or save screenshot as an image
|
|
$output_file = 'output.png';
|
|
file_put_contents($output_file, file_get_contents($api_url));
|
|
echo 'Screenshot saved as ' . $output_file . PHP_EOL; |