Mining Google Web Services: Building Applications with the Google API
One of the first places you'll want to visit is the Webmonkey site at http://hotwired.lycos.com/webmonkey/00/44/index4a.html?tw=programming. Use this tutorial to get PHP set up on your system and learn a little about this product. This PHP tutorial will also introduce you to the language. Unfortunately, the tutorial is also a little outdated and many of the links no longer work. Here's a list of links you can use instead of the links provided with the Webmonkey article (the article information is still very good, so don't be concerned about the outdated links).
-
Apache Server Download (http://httpd.apache.org/download.cgi)
-
Apache Documentation (http://httpd.apache.org/docs-2.0/)
-
PHP Download (http://www.php.net/downloads.php)
-
PHP Manual (http://www.php.net/manual/en/index.php)
Because the Webmonkey article is a little outdated, you'll also want to spend time with the official PHP installation documentation found at http://www.php.net/manual/en/ installation.php. Although this text isn't quite as readable as the Webmonkey version, it's definitely current. Make sure you base any installation decisions, such as whether to use Common Gateway Interface (CGI) or Internet Server Application Programming Interface (ISAPI), on the content of the official documentation.
Tip | Instead of installing Apache, PHP, and MySQL separately, you can use one of the package products on the market. For example, the Apache Friends site at http://www.apachefriends.org/xampp-en.html provides a product named XAMPP that includes all three products plus PERL. Best of all, this product is free and comes in versions for both Linux and Windows. |
One thing you won't need to do to work with Google Web Services is add any extensions. All of the examples in this chapter work fine with the default extensions. You might need to add extensions to process the data, but it's a good idea to work with Google Web Services for a while using the default PHP configuration. Using the default configuration ensures you won't run into any extension-specific errors.
Tip | Like most programming languages, you'll find a variety of third party support sites for PHP. One of the better sites, ByKeyword.com (http://www.bykeyword.com/pages/php.html) includes a list of utilities to edit, manage, and even convert your PHP code. Make sure you also visit sites like Tucows (http://tdconline. tucows .com/). A simple search can net a list of useful shareware and freeware products you can use. |
Don't get the idea that PHP only comes in versions for Apache users. It's true that many people use PHP with Apache, but you can also use it with Internet Information Server (IIS), Personal Web Server (PWS), and Xitami (among other servers). Many of the other servers require that you use the CGI version of PHP, but you can also get an ISAPI version for IIS. The ISAPI version will provide superior performance and a little more flexibility, as well as improved reliability and recoverability. If you want the ISAPI support, you must download the Zip version of the PHP file, not the installer version, which includes only the CGI files.
You can run into a number of issues with Apache that none of the documentation mentions. For example, you might run into a situation where Apache installs and even starts, but you can't access it. Make sure you don't have another Web server installed on the same system. The second Web server could make it difficult or impossible to access the Apache server. This problem is especially prominent on Windows systems because Microsoft simply assumes that every server should have IIS installed.
Note | Make sure you take care of security when you set up Apache. Thawte is offering a free guide that shows how to secure your Apache server using a digital certificate. You can obtain the guide at http://www.thawte.com/ucgi/gothawte.cgi?a=e39560143317026000. Google Web Services can accept either eXtensible Markup Language (XML) over Hyper-Text Transport Protocol (HTTP) or Simple Object Access Protocol (SOAP) requests from PHP; however, the SOAP requests are better documented. The choice of interface depends on what you plan to achieve with the Web service. In many cases, you can achieve acceptable results using the XML over HTTP approach with less coding and effort than using the SOAP approach. If you decide to use the SOAP approach, you'll need to download a SOAP library to use with PHP. You can find this library at http://cvs. sourceforge .net/cgi-bin/viewcvs.cgi/nusoap/lib/ nusoap .php. This file must appear in a central location or in the same folder as your other application files. |