Chooti Malli Chooti Malli - 4 years ago 120
MySQL Question

Google maps + XAMPP

How can I test google maps APIs with XAMPP (as a localhost). Any help on this matter is highly appreciated. A proper tutorial link would be of great help!

Thanks in advance!

Answer Source

Create a blank php file and save it in htdocs of xampp.

Paste the following code:

<!DOCTYPE html>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
    <div id="map"></div>
      var map;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 8
    <script src="**YOUR_API_KEY**&callback=initMap"
    async defer></script>

Replace the "your api key above" with a api key which you can get from the Google Maps website.

You are ready to go.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download