Skip to content

Instantly share code, notes, and snippets.

@shawnsandy
Last active February 22, 2017 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawnsandy/db56a8294461a70b7678927949770e01 to your computer and use it in GitHub Desktop.
Save shawnsandy/db56a8294461a70b7678927949770e01 to your computer and use it in GitHub Desktop.
Google Maps Embed
<?php
// https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=API_KEY
if (isset($address)) {
$add = urlencode('342 glenn ivy terrace spring hill fl 34608');
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$add&sensor=false";
$data = file_get_contents($url);
$geo = json_decode($data);
$this->lat = $geo->results[0]->geometry->location->lat;
$this->long = $geo->results[0]->geometry->location->lng;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment