<?php
// Screen Capture ... Windows Only (probably WAMP only, eg. EasyPHP perhaps), and only if permitted ... RJM Programming ... July, 2014 ... thanks to http://php.net/manual/en/function.imagegrabscreen.php
//  ... other ideas ... thanks to http://stackoverflow.com/questions/757675/website-screenshots-using-php/4526834#4526834
if (strlen(str_replace("(Win", "", $_SERVER['SERVER_SOFTWARE'])) != strlen($_SERVER['SERVER_SOFTWARE'])) {
  $myscreencapture = imagegrabscreen();
  imagejpeg($myscreencapture, "myscreenshot.jpg");
  imagedestroy($myscreencapture);
  echo "<html>\n";
  echo "<head>\n";
  echo "<title>Screen Capture ... Windows Only, and only if permitted ... RJM Programming ... July, 2014 ... thanks to http://php.net/manual/en/function.imagegrabscreen.php</title>\n";
  echo "</head>\n";
  echo "<body>\n";
  echo "<img src='./myscreenshot.jpg' title='Screen Capture'></img>\n";
  echo "</body>\n";
  echo "</html>\n";
} else {
  $thisurl = str_replace(":", "%3A", str_replace("/", "%2F", str_replace("?", "%3F", str_replace("&", "%26", "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI']))));
  header("Location: https://developers.google.com/speed/pagespeed/insights/?url=" . $thisurl . "&tab=desktop");
}
?>

