The frenzy over Google’s new SOAP API is just plain silly. Today I was sent details by a proud PR representative (I’ll not mention them, but you’ll likely hear from them yourselves) of his company’s Google-over-email service, using the SOAP interface. What a waste of space for something that can be done in one line of shell script! Here’s how…

Grab your local Linux/BSD box of preference, put this bit of script into a file, say /usr/local/bin/google.sh, and make it executable.

#!/bin/sh
/bin/cat >/tmp/msg$$ && (/usr/bin/formail -b -t -I 'Content-Type: text/html; charset=ISO-8859-1' -r </tmp/msg$$ && QUERY=`/bin/grep Subject /tmp/msg$$ | /bin/sed -e 's/Subject: *//;'` && /bin/rm /tmp/msg$$ && /usr/bin/lynx -source "http://www.google.com/search?num=100&q=$QUERY") | /usr/sbin/sendmail -t -F 'Google mail server' -f google@example.com

Then, edit your /etc/aliases file, and add in something like:

google: "|/usr/local/bin/google.sh"

Run newaliases and you’re all set. Send email to the google user on your host, and put your query string in the subject field. You’ll get back a nice HTML email with up to 100 results from Google.

It’s more or less a one-liner. (You’ll need lynx and formail, which comes with procmail, installed.)

Please don’t come running to me with SOAP demos until they do something useful.

Think this curmudgeon’s got it wrong? Feel free to teach me a trick or two.