|
Can I add Public Google Calendar Search to my site?I'm intrigued by Google Calendar's public calendar search capability and am wondering if there's any way to reverse engineer it and add it to my own site. Possible? Of course. Just about any form can be reverse engineered if you have the patience to unwind the code that's inside a given page. In this case, you're talking about Google Calendar's public calendar search capability: ![]() Here's what you want to do, however. Enter a rudimentary keyword like "music" and click on "Search Public Events", at which point you now get a more sophisticated search: ![]() Rather than crack open the code, we can simply do a search and examine the resultant URL. Enter "music" as the search term, "denver" as the location and "today" as the time, and it produces a list of music venues in Denver, Colorado. But more importantly, the URL of that page is: http://www.google.com/calendar/events?state=mode%3Dlist%2C1%26date%
3D20070413&q=music&btnG=Search+Public+Events&ql=denver&qt=&qtd=today Let me make this a bit clearer by highlighting the words we searched for in bold: http://www.google.com/calendar/events?state=mode%3Dlist%2C1%26date%
3D20070413&q=music&btnG=Search+Public+Events&ql=denver&qt=&qtd=today As an experiment, I'll strip out all the name=value pairs that don't have specific information I've entered in my original search, which reduces it down to: http://www.google.com/calendar/events?q=music&ql=denver&qtd=today
Surprise, that works just as well (copy and paste that into the Location box of your Web browser). Better, we can now reverse engineer it further and recognize that what we're really seeing here is: Target URL: http://www.google.com/calendar/events Armed with that information, it's simple to pour that into a rudimentary HTML form: <form method="get" action="http://www.google.com/calendar/events">
Query: <input name="q"><br /> Location: <input name="ql"><br /> Date: <input name="qtd"><br /> <input type="submit" /> </form> It ain't pretty, but it'll work. Try it: That's not very attractive, but it does work! We can also use that same URL to embed searches into your text too, as demonstrated here: And an inline example too:
<a href="http://www.google.com/calendar/events?q=blues&qtd=this+week&ql=denver%2C+co" target="_blank">Blues events this week in Denver</a>. Simple enough.
Which would look like this: Blues events this week in Denver. Finally, here's a really fancy version of this form that demonstrates how you can turn one or more fields into hidden variables and simplify the form for your own uses: <form method="get" action="http://www.google.com/calendar/events">
<div style="border:1px solid #999;width:400px;padding:6px;background-color:#cce;"> <div style="background:#000;color:#fff;padding:4px;font-size:150%; margin-bottom:10px;">Dave's Denver Event Calendar</div> Looking for a concert, band, dance, theatrical review or other event here in the beautiful Denver metro area? No worries, I can help you find it! <br /><br /> <table border="0"> <tr><td align="right">Event name or category: </td><td> <input type="text" name="q" /> </td></tr><tr><td align="right"> and your time range: </td><td> <input type="text" name="qtd" value="today" /> </td></tr></table> <br /> <input type="hidden" name="ql" value="denver, co" /> <center> <input type="submit" value="Ready? Let's find it!" /> </center> </div> </form> Formatted and interpreted, it looks like this: Hope that helps you get going with your reverse engineering project!
Categorized:
CGI Scripts and Web Site Programming
(Article 7318,
Written by Dave Taylor)
Tagged: forms, google calendar, html, usability Previous: In Google's Gmail, can I delete individual messages in a discussion thread? Next: How do I change my Windows XP Screen Saver password? Subscribe!
I'm loving this article! I would never have been able to reverse engineer something like this. I'm trying to modify it to suit my needs, however, and am having troubles. I want to limit the search to a specific set of calendar events to which I've added a unique keyword. Is it even possible to allow the user to add in his/her own "q" but also add a hidden "q"? What I really want to do is to be able to search just a specific calendar, but Google doesn't allow that yet, or at least not as I've found. Ideas? Lost cause? Posted by: Kelly at May 1, 2007 9:25 AMhey dave almost everything you search for on the net for codes and help leads to myspace setups and codeings. all i want is a comment box like you have here...where all people commenting is in private and goes only to a specific email that i will set up..i will want to change the codes to match my site page...including buttons...id like to set it up just like i have my jump boxes and music box. ive been searching for help to do this and finally came across yours and thought maybe you can help me. ty Posted by: razzy at May 4, 2007 6:25 AMThe empire of IT soloutions. Posted by: Purushottam Sanjiv Kumar at November 1, 2007 4:14 AMHi how ru where ru ,...................... Posted by: lovely at June 12, 2008 12:27 AMGoogle appears to have shut down this back door into calendar search. I cannot see a way to search calendars now without providing a Google login. Posted by: G-Money at January 6, 2009 8:05 AMIs it possible to add, edit or delete events to the public calendar by every one. Posted by: Keeth at June 27, 2009 5:10 AMis it possible visitors of my site add events to I have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and RSS Feeds Building Web Site Traffic Business and Management CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above Facebook Help Google Plus Help HTML and CSS Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Mac OS X Help Pay Per Click (PPC) Advertising Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help WordPress Help |