Building a Geocoding Web Service, Page 2
Displaying the Google Map
Now that the coordinates have been retrieved, all you need to do is pass them into the appropriate Google Maps API method. To do so, paste the following code into the PHP Web services client (geocodeclient.php), being sure to place it below the closing PHP delimiter (?>). You'll also need to replace ADD_YOUR_KEY_HERE with your Google Maps API key. If you haven't yet registered for your key, see the instructions found in the opening installment of this series.
Execute the geocodeclient.php script anew and you'll see the following map:
There you have it! A custom, end-to-end Web mapping solution built entirely from open source and freely available services.
About the Author
W. Jason Gilmore (http://www.wjgilmore.com/) is the open source editor for Apress. He's the author of the best-selling Beginning PHP 5 and MySQL: Novice to Professional (Apress, 2004. 758pp.). Along with Robert Treat, Jason is the co-author of the forthcoming Beginning PHP 5 and PostgreSQL 8: From Novice to Professional, due out at the conclusion of 2005. Jason loves receiving e-mail, so don't hesitate to write him at wjATwjgilmore.com.