Skip to content

Instantly share code, notes, and snippets.

@stefanzweifel
Last active April 3, 2020 07:07
Show Gist options
  • Save stefanzweifel/968e68785277013ac214 to your computer and use it in GitHub Desktop.
Save stefanzweifel/968e68785277013ac214 to your computer and use it in GitHub Desktop.
Screeenly API Example
<?php
$payload = array(
'key' => 'YOUR-API-KEY',
'url' => 'https://www.youtube.com/'
'height' => 800, // Optional
'width' => 500 // Optional
);
$payload = json_encode($payload);
$ch = curl_init('http://screeenly.com/api/v1/fullsize');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload))
);
$result = curl_exec($ch);
var_dump($result);
$result = json_decode($result);
$path = $result->path;
?>
<hr>
<img src="<?php echo $path; ?>" alt="Screenshot">
@p-drolima
Copy link

Hi, i am having problems manipulating image output size. seems that there is a maximum set? is this correct. i need a thumbnail size of 265w x 201h but of the desktop version of website. any advice on implementation?

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment