Push growl notifications to Prowlapp with telnet

Assuming that you know what I am talking about, here is how it was done:

> cat ~/bin/http_get.sh
 #!/bin/bash
 if [ $# -ne 4 ]
 then
 echo "Example: `basename $0` test.com 80 test.com / | telnet"
 exit 1
 fi
 echo "open $1 $2"
 sleep 2
 echo "GET $4 HTTP/1.0"
 echo "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4"
 echo "Host: $3"
 echo
 echo
 sleep 2
 > ~/bin/http_get.sh www.prowlapp.com 80 www.prowlapp.com '/publicapi/add?apikey=YOUR_PROWL_KEY_GOES_HERE&application=dah&event=doo' | telnet
 telnet> Trying 209.20.72.170...
 Connected to www.prowlapp.com.
 Escape character is '^]'.
 HTTP/1.1 200 OK
 Date: Mon, 10 Sep 2012 23:40:33 GMT
 Server: Apache/2.2.3 (CentOS)
 X-Powered-By: PHP/5.1.6
 Vary: Accept-Encoding
 Content-Length: 118
 Connection: close
 Content-Type: text/xml
 <?xml version="1.0" encoding="UTF-8"?>
 <prowl>
 <success code="200" remaining="999" resetdate="1347324034" />
 </prowl>
 Connection closed by foreign host.

Thanks to this tonycode.com blog post for the script idea with telnet.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s