a few words about web development

How to take a screenshot of a wepage?

Rendering HTML & CSS to a single PNG or JPEG image
With the code below you can create a high resolution screenshot of any website. You don't even need to install anything on your server and the code works fine under Windows/Linux/OSX.

$url = 'http://de77.com/'; //URL to website you want to screenshot
$json = json_decode(file_get_contents('http://api.rest7.com/v1/html_to_image.php?url=' . $url . '&format=jpg')); //jpg is smaller than png
if ($json->success)
{
    $img = file_get_contents($json->file);    
    file_put_contents('screenshot.jpg', $img);
}
else
{
    echo 'An error occured';
}

Comments