For this tutorial, we'll write a simple program that uses Google's Geocoding API to retrieve the latitude and longitude for a specific address e.g., 104 Franklin St, New York City. What makes Temboo especially powerful and useful is that, once you know how to use one API, you know how to work with any API in our Library.
1Create a new
.html file and save it as
temboo-example.html into a folder where you'll save the rest of your project files.
2Create a new
.php file and save it as
proxy-server.php into the same project folder as your
5Change the name of the resulting folder to
js-sdk and move it into the same folder as your
6Download the latest Temboo PHP SDK and unzip the file.
7Change the name of the resulting folder to
php-sdk and move it into the same folder as your
temboo-example.html file. Your project folder should look similar to the screenshot below:
8Go to the Google > Geocoding > GeocodeByAddress Choreo in our Library.
9Enter any address or ZIP code in the Address input field e.g., 104 Franklin Street, New York City.
10Now click Run. After a moment you'll see the data that Google sends back shown in the Output section.
temboo-example.html file, make sure that your script source points to the correct location of the
temboo.js SDK file.
13In the same file, we'll also want to confirm that the location of our proxy is correctly specified. Our server is
// Instantiate the client proxy with the URI of your server proxy var temboo = new TembooProxy('proxy-server.php');
14Back on the Choreo page, scroll down to the Proxy Code snippet and select PHP or another server-side proxy language from the Proxy Code Language dropdown menu. Copy the proxy code snippet and paste it into your
15In the same
.php file, make sure that the
php-sdk SDK folder that you downloaded earlier.
16Run the PHP server. For instance, if you're running the code using a web host, you can upload your project folder to your site via FTP client. If you're using Apache for PHP to run a local server, you'd run the following command from Terminal:
sudo apachectl start
temboo-example.html in the browser at the url where you're server is running. For instance, if you're running the PHP server locally:
Once you've got your code up and running, you're ready to move on and do more. From monitoring your running applications, to moving your generated Temboo code to your preferred development environment and sharing it with colleagues, collaborators and friends - we've got you covered.
Want to try this example in a different language? Check out this tutorial for working with non-PHP proxy languages.
We're always happy to help. Just email us at email@example.com, and we'll answer your questions.