I just hacked together a neat little PHP script that allows me to Google search right from Windows Explorer in Windows 7. I was inspired by this guy. I don’t wait around for Google, I’ll do it myself. 😀
Windows 7 introduces a new feature which allows you to add search engines right to Windows Explorer. It’s not as convenient as in a web browser (the search engine is represented by a file somewhere on your computer that you download) but it works.
It uses the standard OpenSearch spec (with their own Microsoft twist, of course!) to query search engines which already conform to this standard. Basically you can pass a script your search terms and get them back in an RSS or Atom feed which Explorer or any OpenSearch compatible client can parse and display how they like.
Google doesn’t offer any such feed. So I made a PHP script to parse the HTML output Google feeds web browsers (using this library) and spit out an OpenSearch RSS feed. Works pretty good.
Had a few annoying problems along the way… a big one was I couldn’t always get Explorer to parse it and it doesn’t tell you why. For some reason I didn’t think to try to view the feed in Internet Explorer to get a more detailed error report. Turns out Google pages use a different encoding than what I was marking the XML file with, and that was causing feeds with smart quotes to annoy Explorer.
Anyways it’s working now. You can try it out with this. Download and double click to have Explorer open a search window. This DOES proxy the results through my server so don’t use that if you plan on using it regularly… here’s the source code. Go put it on your own server. Just remember to change the urls in all the files to point to your server instead of mine.
There’s an extra file, opendescription.xml. AFAIK it’s not NEEDED for Explorer but it’s part of the OpenSearch spec so there it is. This should be compliant with the spec, so not just Explorer can use it.