Google Suggest functionality on a web page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
itp
Forum Commoner
Posts: 67
Joined: Fri Jun 15, 2007 6:50 am

Google Suggest functionality on a web page

Post by itp »

Does anyone know of a Google API or recipe to permit me to add a imput text box to my HTML page that links dynamically to the "Google Suggest" database. I would like user to start typing a search string on my page and see a list of links as she is typing.

I supposed that I would require a javascrpit XMLHttpRequest/ActiveXObject object to generate a get and some PHP to open and get information.

ref: http://www.google.com/webhp?complete=1&hl=en
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I'm not sure there is an API to use google's suggest box. But setting up some AJAX listening to the onkeyup or onkeydown events could start you in the right direction. You'd probably need to find a database of common search queries, but I'd imagine those are available in lots of places (for seo people).
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

itp
Forum Commoner
Posts: 67
Joined: Fri Jun 15, 2007 6:50 am

Post by itp »

I don't want to create my own terms database or repository of documents. I just want to hook up to Google suggest page, like you can do with Google Maps.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

itp wrote:I don't want to create my own terms database or repository of documents. I just want to hook up to Google suggest page, like you can do with Google Maps.
Unless Google.com gives you the tools to do so, then Google probably won't allow you to do it (without retaliation). You could always create your database of search terms specific to search terms that were actually used on your site, so every time someone searches, you save it. It'll keep things more relevant too. An issue you'll face will likely be dealing with spelling errors.
Post Reply