Advertisement
foozzi

online screenshots

Mar 20th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2. function SiteScreenshot($url/*, $size='200'*/, $format='png') {
  3.     $Filename = md5($url/*.$size.$resolution*/).'.'.$format;
  4.     // Директория где лежат скрины
  5.     $ScreenshotDirectory = "i/";
  6.     // Проверяем если есть такой файл в папке скринов
  7.     if(@is_file($ScreenshotDirectory.$Filename)) {
  8.         return $ScreenshotDirectory.$Filename;
  9.     }
  10.      else {
  11.         $Image = @file_get_contents("http://mini.s-shot.ru/".$format."/?http://".$url);
  12.         $OpenFile = fopen($ScreenshotDirectory.$Filename, "w+");
  13.         // Сохраняем изображение
  14.         $Write = fwrite($OpenFile, $Image);
  15.         return $ScreenshotDirectory.$Filename;
  16.      }
  17. }
  18. ?>
  19. <form action="" method="post">
  20. <input type="text" name="url" value="" />
  21. <input type="submit" name="b" value="screen" />
  22. </form>
  23. <?php if(isset($_POST['url'])) {  echo "<img src='".SiteScreenshot($_POST['url'])."'>"; } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement