(defun bja-sunrise ()
"Display sunrise, sunset & twilight information."
(interactive)
(shell-command "~/sunrise_http_post.rb"))
...
require 'net/http'
YOUR_ID = 'BGPOWELL' # A unique ID per comment above
YOUR_CITY = 'Fairfax' # The name of your city
YOUR_STATE = 'VA' # Two letter state abbreviation
now = Time.now
month = now.month
day = now.day + 1 # Tomorrow
year = now.year
response = query.post('/cgi-bin/
aa_pap.pl', "FFX=1&ID=#{YOUR_ID}&xxy=#{year}&xxm=#{month}&xxd=#{day}&st=#{YOUR_STATE}&place=#{YOUR_CITY}&ZZZ=END")
if response.body =~ /Begin civil twilight[^0-9]*(\d+:\d{2} [ap].m.).*Sunrise[^0-9]*(\d+:\d{2} [ap].m.).*Sunset[^0-9]*(\d+:\d{2} [ap].m.).*End civil twilight[^0-9]*(\d+:\d{2} [ap].m.)/m
puts "#{month}/#{day}/#{year}"
puts "Begin Twilight: #{$1}"
puts "Sunrise : #{$2}"
puts "Sunset : #{$3}"
puts "End Twilight : #{$4}"
end
end