Home arrow PHP arrow Page 2 - Create Your Own Search Engine with PHP and Google Web Services
PHP

Create Your Own Search Engine with PHP and Google Web Services


In this article, Ahm shows us how to retrieve search results from Google via Web Services, effectively creating our own search engine.

Author Info:
By: Ahm Asaduzzaman
Rating: 4 stars4 stars4 stars4 stars4 stars / 55
February 12, 2003
TABLE OF CONTENTS:
  1. · Create Your Own Search Engine with PHP and Google Web Services
  2. · Interacting with Google's Web Services
  3. · Walkthrough Example
  4. · Conclusion

print this article
SEARCH DEVARTICLES

Create Your Own Search Engine with PHP and Google Web Services - Interacting with Google's Web Services
(Page 2 of 4 )

Google has made only three methods available in their Web API. You will see soon that it’s just more than enough to build powerful applications.
Here is what they look like:

doGoogleSearch() – search for specified term in the Google database.
doGetCachedPage() – retrieve a page cache from the Google cache.
doSpellingSuggestion() – retrieve a spelling suggestion from Google.

The above methods exposed by the Google’s Web Services make it possible to use number of very cool features – Web search, cached document retrieval, phrase correction – in a simple but extensible manner, which opens up very interesting new possibilities for Web developers. Pic. 1 shows how a client program invokes a method from Google’s Web Services. Let’s rock and roll.

Pic. 1: Exchanging SOAP packets between the client and Google Web Services
Pic. 1: Exchanging SOAP packets between the client and Google Web Services


The skeleton of our client code (pseudo codes) will look something like following (Pic. 2):

<?php
if (!$_POST[‘query’])
{
//display form

}

else
{
//execute query on Google

}

Pic. 2: Code Skeleton

As you can see, the script is split into two sections, one for the search form and the other for the search result. An "if" statement is used to decide which section of the script to execute.
blog comments powered by Disqus
PHP ARTICLES

- Removing Singletons in PHP
- Singletons in PHP
- Implement Facebook Javascript SDK with PHP
- Making Usage Statistics in PHP
- Installing PHP under Windows: Further Config...
- File Version Management in PHP
- Statistical View of Data in a Clustered Bar ...
- Creating a Multi-File Upload Script in PHP
- Executing Microsoft SQL Server Stored Proced...
- Code 10x More Efficiently Using Data Access ...
- A Few Tips for Speeding Up PHP Code
- The Modular Web Page
- Quick E-Commerce with PHP and PayPal
- Regression Testing With JMeter
- Building an Iterator with PHP

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials