PHP Classes
elePHPant
Icontem

File: Example_GoogleMapsHTTPRequest.zip

Recommend this page to a friend!
  Classes of . Karatag  >  Karatag Google Maps HTTP Request  >  Example_GoogleMapsHTTPRequest.zip  >  Download  
File: Example_GoogleMapsHTTPRequest.zip
Role: Example script
Content type: text/plain
Description: Example File to get coordinates from Google Maps
Class: Karatag Google Maps HTTP Request
Get coordinates of an address using Google Maps
Author: By
Last change:
Date: 9 years ago
Size: 751 bytes
 

Contents

Class file image Download
<?php
// Include the GoogleMapsHTTPRequest class
include_once('./GoogleMapsHTTPRequest.class.php');

$address = 'In der Mark 57'; // Street
$city = 'Bochum'; // City
$country = 'Germany'; // Country
$zip = '44869'; // Zip-Code, PLZ

/**
 * Paut your Google Maps Api Key Here!
 * If You don't have a Key yet? You can get it here: http://www.google.com/apis/maps/signup.html
 */
$GoogleMapsApiKey = 'YOUR-API-KEY';


$ga = new googleRequest($address, $city, $country, $zip);

$ga->setGoogleKey($GoogleMapsApiKey);

$ga->GetRequest();

// You can use the result to place your Mark in the Map
echo '<br />LATITUDE: '.$ga->getVar('latitude');
echo
'<br />LONGITUDE: '.$ga->getVar('longitude');

?>