I am using the Wordpress mshots api to generate automatic thumbnails of websites from the site url. I am using a customfield to capture the website url and pass the value to the mshots url to return the screenshot.
<?php
$shot = get_post_meta($post->ID, 'website_url', true);
$url = str_replace('http://', '', $shot);
$imgurl = "http://s.wordpress.com/mshots/v1/".$url;
?>
<img src="<?php echo $imurl ?>" width="300" height="200" alt="<?php the_title(); ?>" />
It is working fine. But I wonder how can I create a local cache of the generated screenshots in the theme folder, so that it can be displayed instead of making a remote server call every time the image is requested.