<?php
  if (isset($_GET['gp_api_key'])) {
     echo str_replace('?key=YOUR_API_KEY&', '?key=' . htmlspecialchars(urldecode($_GET['gp_api_key'])) . '&', file_get_contents(dirname(__FILE__) . "/google_places_poc.html"));
  } else if (isset($_POST['gp_api_key'])) {
     echo str_replace('?key=YOUR_API_KEY&', '?key=' . htmlspecialchars(urldecode($_POST['gp_api_key'])) . '&', file_get_contents(dirname(__FILE__) . "/google_places_poc.html"));
  } else {
     echo "<!doctype html>
<html>
<body>
<h1>Google Places API Autocomplete Proof of Concept</h1>
<form action=./google_places_poc.php method=POST>
<input style='width:250px;' placeholder='Google Places API Key' value='' type='password' name=gp_api_key id=gp_api_key></input>
<input type=submit value=Start></input>
</form>
</body>
</html>";
  }
?>
