Skip to content

Instantly share code, notes, and snippets.

@jonlambert
Last active September 14, 2018 14:08
Show Gist options
  • Save jonlambert/3b22fc0eb4702a665420 to your computer and use it in GitHub Desktop.
Save jonlambert/3b22fc0eb4702a665420 to your computer and use it in GitHub Desktop.
require 'net/http'
def fetch
puts "Super Simple (Shakespearian) Question Fetcher (v1.0)"
puts "(c) Mr J. Outer-Whipsy 2014 (All rights reserved)"
puts "Refreshing questions..."
url = URI.parse('http://h4inschools.schoolsbroadcast.org.uk/v1/orad/source.xml')
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
xml = res.body
File.open('/Users/sm/Desktop/open.xml', 'w') { |file|
file.write(xml)
puts "Saved. Waiting...\n"
}
sleep 10
fetch
end
fetch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment